tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Kolinko" <knst.koli...@gmail.com>
Subject Re: Jar wars - Conflicting classes
Date Sat, 03 Jan 2009 17:34:43 GMT
2009/1/3 David.Meldrum <david.meldrum@verizon.net>:
> Windows XP SP 3  Tomcat 6.0.1  JVM 1.6.0
>
> Must all conflicting classes be sorted out on one instance of Tomcat?
> I have learned not to put application jars (classes) in the jre lib, since
> they then become common to all applications and if there is a duplicate, but
> not exact duplicate, then things crash.  What I am wondering is, are all the
> classes loaded into the _same_ JVM?  Here is the problem I ran into.
>  Application #1 uses some Quartz scheduling classes.  Application #2 also
> uses Quartz, but apparently a different version.  Can these applications
> live on the same Tomcat instance?  In other words if each of the
> applications has it's own  lib, can the classes overlap?  I get the feeling
> the applications will have to be sorted out to use the same Quart library.
>  I read the  documentation regarding Class Loader and understand the order
> in which libraries are searched, but do the classes end up in one single
> aggregated JVM memory?
>

You can put them in WEB-INF/lib folders of your applications and they
will happily coexist separately.

The problem will occur is some of them are put into the common lib folder
of Tomcat, or, even worse, into JRE lib folder, as you mentioned.

Well, the problem do not occur always.
It depends. It depends on how the library is used, what are its dependencies,
but when it occurs, the easiest answer is to remove the library either from
the application or from commons.

I may add that a) classloader delegation rules in web applications are
different from those of core Java. You may read [1] and try to figure what
implications that impose. b) web applications may be unloaded, reloaded
and thus the classes may have gone away. Thus classloader issues are
more observable here than in a standalone application.


For reference,
[1] http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Best regards,
Konstantin Kolinko

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


Mime
View raw message