tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric B." <ebe...@hotmail.com>
Subject Re: Loading Jar files in a particular order on Tomcat 6
Date Sat, 03 Oct 2009 23:00:23 GMT
"Caldarale, Charles R" <Chuck.Caldarale@unisys.com> wrote in message 
news:99C8B2929B39C24493377AC7A121E21F84054C1188@USEA-EXCH8.na.uis.unisys.com...
> From: Rasmus Larsen [mailto:kolibriasdf@gmail.com]
> Subject: Loading Jar files in a particular order on Tomcat 6
>
> I'm working on a web application where I have dependencies on two
> different jars containing two different versions of the same class.

> Ugly, at best.

> I've created a custom class loader, which first first tries to load
> classes from a specific set of jars, and if that fails it just loads
> the class in the standard manner.

> Unless you have explicit control over the classpath used by each
> classloader in the hierarchy (which you don't), a custom classloader
> is pretty much the only way to handle this.

I've always noticed that the classloader loads things in alphabetical order. 
Additionally, if it finds the same class in 2 different jars, it only seems 
to use the class from the first jar.

I would suggest just trying to rename the "important" jars if possible with 
a prefix of something like aaa_<jarname>.jar to force the classloader to 
pick it up first.

Just a thought....

Eric





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


Mime
View raw message