I have tomcat6 running on ubuntu, with java 1.6.0_20.

One of the webapps causes an error, which has as root cause:

java.lang.ClassNotFoundException: javax.mail.Authenticator

the mail.jar and activation.jar (found these as culprit in my online research) are in the /var/lib/tomcat6/common/lib directory and in the lib directory of the webapp. The javax.mail.Authenticator.class is in mail.jar.

What else can I try to get it to work? are there logs anywhere that can help me find the real error?


  • removed the duplicate .jar files to avoid possible conflicts. tried
  • running tomcat (on another machine, tomcat7 on windows) with verbose class loading:
[Loaded javax.mail.Address from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.internet.InternetAddress from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.Part from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.BodyPart from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.internet.MimePart from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.internet.MimeBodyPart from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.Multipart from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.internet.MimeMultipart from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.activation.DataSource from C:\Program Files\Java\jdk1.6.0_26\jre\lib\rt.jar]
[Loaded javax.mail.Message from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded javax.mail.internet.MimeMessage from file:/C:/.../build/web/WEB-INF/lib/mail.jar]
[Loaded org.apache.naming.factory.MailSessionFactory from file:/C:/Program%20Files/Apache%20Software%20Foundation/Apache%20Tomcat%207.0.11/lib/catalina.jar]
[Loaded org.apache.naming.factory.MailSessionFactory$1 from file:/C:/Program%20Files/Apache%20Software%20Foundation/Apache%20Tomcat%207.0.11/lib/catalina.jar]
28.07.2011 09:24:36 com.sun.faces.lifecycle.LifecycleImpl phase
WARNUNG: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@698b41da) threw exception
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator

So that does not tell me anything new.


Do you use a mail session provided by Tomcat or do you create the mail session within your Application?

Look here for how to use a mail session provided by Tomcat:


That is the way you want to use an SMTP connection in Tomcat.

If you are using the mail session provided by Tomcat it needs the mail and activation jar in the classpath of the Tomcat. Normally this is achieved by putting these jar files into the tomcat/lib directory (if you download the package from tomcat.apache.org)

I guess the problem you have is caused by the special Tomcat Ubuntu directory configuration - I do not know which directory is equal to the tomcat/lib directory there. I usually install the original distribution from tomcat.apache.org by simply extracting it into the desired directory on my Ubuntu machines.

  • 1
    Okay, that did do the trick. Although following that instructions felt a bit like "stand on one foot, wave the head of the sacrificed chicken over the server and chant >Ommmmm<" Now there is no stacktrace anymore, but still some kind of other error. I'll figure that one out on my own, I guess. Thanks! – brandstaetter Jul 28 '11 at 8:51

have you tried to set JAVA_HOME and CLASSPATH ? on /etc/environment ?

  • from what I've read, tomcat ignores that – brandstaetter Jul 28 '11 at 6:33
  • tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html For classes and resources that must be shared across all web applications, place unpacked classes and resources under $CATALINA_BASE/shared/classes, or place JAR files containing those classes and resources under $CATALINA_BASE/shared/lib. how about make symlink the libs to above path ? – chocripple Jul 28 '11 at 7:08
  • I had already tried that, no change. – brandstaetter Jul 28 '11 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.