tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric B." <>
Subject Re: Loading Jar files in a particular order on Tomcat 6
Date Sat, 03 Oct 2009 23:00:23 GMT
"Caldarale, Charles R" <> wrote in message
> From: Rasmus Larsen []
> 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....


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message