• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Properties not properly set in tomcat mail session.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have an anoying problem with tomcat and the use of mail sessions.

I've created a test servlet (MyServlet) in my attempts to narrow down the problem. The problem is that the mail session gotten from the jndi-lookup doesn't get the properties I've set in the server.xml.

Here's my MyServlet:



The output I get when starting the Tomcat server is:



First of all the init()-method seems to be run twice. Which I guess is ok since tomcat is the servlet container and can create as many instances of the servlet it wants. But the second time around the mail session doesn't get the properties I have configured in server.xml. You see that the javax.mail.Session instances are not the same in the two runs. All subsequent lookups for mail/Sesssion retrieves the Session-instance with the wrong (javax.mail.Session@1c1c92b) configuration, hence my application won't be able to use the session to send emails.
Any help to understand/solve this problem is very appreciated.

Here's the relevent stuff from my server.xml:


And here's the resource-ref in the web.xml:



Cheers
/Anders
[ November 06, 2008: Message edited by: Anders Lund�n ]
 
Anders Lunden
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to mention that I'm using Tomcat 5.5.17.

/Anders
 
reply
    Bookmark Topic Watch Topic
  • New Topic