You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ma...@derivativefitch.com on 2007/03/23 10:50:37 UTC

JavaMail + Tomcat

Hi,

Regarding JavaMail:
Is it possible to put the mail.jar (and activation.jar) in the web 
application's WEB-INF/lib folder instead of tomcat's common/lib?

I did have it working in common/lib but then moved it to 
[web-app]/WEB-INF/lib - due to requirements - and I now get the following 
error:
java.lang.NoClassDefFoundError: javax/mail/Session

on the line: 
session = (Session) envCtx.lookup("mail/Session");

The web.xml looks like this - I have also tried putting the mail.jar and 
activation.jar on the projects classpath.

<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Thanks,

Matt 
 

______________________________________________________________________
Confidentiality Notice:  The information in this e-mail and any attachment(s) is confidential and for the use of the addressee(s) only.  If you have received this e-mail in error, please delete this e-mail.  Unauthorized use, reliance, disclosure or copying of the contents of this e-mail, or any similar action, is prohibited.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

Re: JavaMail + Tomcat

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
Matt.Nelson@derivativefitch.com wrote:
> Regarding JavaMail:
> Is it possible to put the mail.jar (and activation.jar) in the web 
> application's WEB-INF/lib folder instead of tomcat's common/lib?
>
> I did have it working in common/lib but then moved it to 
> [web-app]/WEB-INF/lib - due to requirements - and I now get the following 
> error:
> java.lang.NoClassDefFoundError: javax/mail/Session
>
> on the line: 
> session = (Session) envCtx.lookup("mail/Session");
>   
If you want to get javax.mail.Session reference using JNDI you have to 
put those jars in common/lib.
You can have them in WEB-INF/lib if you will create mail Sessions object 
by hand.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


RE: JavaMail + Tomcat

Posted by "Fuhs, David" <DF...@csuchico.edu>.
I have two or three web applications that use JavaMail.  I develop on a
Macintosh then drop the WAR files on Tomcat running on a Red Hat Linux
system.  In each case it was sufficient to put the JAR files in
WEB-INF/lib.  My web.xml files do not contain any <resource-ref> tags. 

-----Original Message-----
From: Matt.Nelson@derivativefitch.com
[mailto:Matt.Nelson@derivativefitch.com] 
Sent: Friday, March 23, 2007 2:51 AM
To: users@tomcat.apache.org
Subject: JavaMail + Tomcat

Hi,

Regarding JavaMail:
Is it possible to put the mail.jar (and activation.jar) in the web 
application's WEB-INF/lib folder instead of tomcat's common/lib?

I did have it working in common/lib but then moved it to 
[web-app]/WEB-INF/lib - due to requirements - and I now get the
following 
error:
java.lang.NoClassDefFoundError: javax/mail/Session

on the line: 
session = (Session) envCtx.lookup("mail/Session");

The web.xml looks like this - I have also tried putting the mail.jar and

activation.jar on the projects classpath.

<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Thanks,

Matt 
 

______________________________________________________________________
Confidentiality Notice:  The information in this e-mail and any
attachment(s) is confidential and for the use of the addressee(s) only.
If you have received this e-mail in error, please delete this e-mail.
Unauthorized use, reliance, disclosure or copying of the contents of
this e-mail, or any similar action, is prohibited.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org