tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <>
Subject Re: Configuring E-Mail Session via JNDI
Date Thu, 06 Aug 2015 07:01:37 GMT

Am 6. August 2015 06:12:14 MESZ, schrieb Tim Gustafson <>:
>I'm trying to configure an e-mail session in my Tomcat configuration
>like this:
><Resource name="mail/session"
>      auth="Container"
>      type="javax.mail.Session"
>      mail.transport.protocol="smtp"
>      mail.debug="true" />
>From my web application, I'm instantiating a Session object like this:
>Context initialContext = new InitialContext();
>session = (Session)
>When I go to send e-mail from my web applet, I'm getting:
>java.lang.ClassNotFoundException: javax.mail.Authenticator
>I find that error a little odd, as I'm not doing SMTP AUTH anywhere,
>but I'll let that go for now.  Based on documentation I found while
>Googling that error message, I copied the mail.jar file from my
>Netbeans library into Tomcat's lib folder, and now I get:
>java.lang.ClassCastException: javax.mail.Session cannot be cast to

This error indicates that you have mail.jar in two different classloaders. Probably common
loader and webapp loader. The one in tomcats lib folder  - common loader - is the right one.

>Removing Java Mail from my Netbeans project does not appear to be an
>option as it will refuse to compile the project without it.

I don't use netbeans, so I can't help you there. You could look for tutorials about database
drivers, they will probably be handled the same way. 


>I'm at a loss.  What am I doing wrong?  Thanks in advance for any help
>with this - it has been driving me nuts for a while now!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message