0

I am trying to send mail in my web application. I am using the libraries javax.mail-1.4.4 and activation-1.1. My configuration is set up like described in the Tomcat Docs here http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html#JavaMail_Sessions

The web.xml file is configured properly according to this information. The context.xml where I store the settings is configured properly as well (or at least should be) with mail.*, auth, name, type info set properly.

When trying to send a mail this way, I get the following error:

Exception in thread "Thread-27" java.lang.NoClassDefFoundError: javax/mail/Authenticator

in this line:

session = (Session) envCtx.lookup("mail/Session");

I've looked through some solutions, like missing mail/activation libraries, checked up on those but none I could find were able to help me. Any idea what I could do to fix this or get in closer on the error?

Perception
  • 79,279
  • 19
  • 185
  • 195
private_meta
  • 561
  • 4
  • 19
  • what directory did you place the jar files in? – Woot4Moo Mar 12 '12 at 16:58
  • possible duplicate of [java.lang.NoClassDefFoundError: javax/mail/Authenticator, whats wrong?](http://stackoverflow.com/questions/1630002/java-lang-noclassdeffounderror-javax-mail-authenticator-whats-wrong) – Woot4Moo Mar 12 '12 at 17:00
  • @private_meta : Had you added something like this `C:\install\javamail-1.4.4\mail.jar` to the `Java Classpath` on your `Tomcat Properties Window`, under `Java` Tab ? – nIcE cOw Mar 12 '12 at 17:14
  • @Woot4Moo that was exactly what I was looking at before I wrote this, and I wrote this because THAT one did not help me. – private_meta Mar 12 '12 at 17:31

1 Answers1

1

"should be" is the operative phrase. I'd recommend that you believe Tomcat when it tells you it's missing things. You have not configured things properly until Tomcat says you have.

I'd recommend that you put them into the Tomcat /lib folder and see if that makes a difference.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • 1
    Thank you for that hint. I added the libraries to the project in netbeans and I thought they would be added and used like other libraries when creating the WAR file, but that was not the case, apparently. I still couldn't get the actual mailing to work, so I don't know yet if the problem is actually fixed entirely. I will write back if that is the case. – private_meta Mar 13 '12 at 09:58