-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard,

On 11/30/12 2:36 PM, Richard Frovarp wrote:
> I am trying to use JNDI to configure the mail session. I appear to
> be running into trouble because I don't have the mail and
> activation jars in tomcat/lib, but rather app/WEB-INF/lib.
> 
> If I put them in both places I get an error, If I just leave them
> in the application I get ClassNotFoundException.
> 
> The smart thing would be to put them in tomcat/lib, but I have
> other web applications running on the system without using JNDI,
> that have their own versions of mail and activation. My fear is if
> I put the file in tomcat/lib for this application, I'll break the
> other ones.
> 
> I am defining the JNDI values inside of the application's context.
> Is there any way to not put it in tomcat/lib and still have it
> work? Or if I put them in tomcat/lib, will my existing applications
> still work just fine since they aren't using JNDI?

Tomcat uses the server's 'common' ClassLoader as the context for
loading JNDI resources while initializing a Context (webapp).
Unfortunately, if you want Tomcat to manage a JNDI resource for you,
all dependencies for that resource must be in CATALINA_BASE/lib.

It's not really possible to bootstrap a webapp using its own
WebappClassLoader (which loads from WEB-INF/lib then delegates to the
parent) because the context can specify its own classloader as part of
its configuration. Re-threading the class loader during context
initialization would be ... tricky.

IIRC, JavaMail itself is quite backward-compatible. Just throw the
latest version into CATALINA_BASE/lib and remove the others from the
individual webapps.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC5K44ACgkQ9CaO5/Lv0PDzQACeLPc9JupHx52+mBJ9eVV5XGJy
1wcAnjUhi1yIH0MNcDX+jTfn3ApbgGNP
=2f1X
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to