Control the classpath ordering of jars in WEB-INF/lib on Tomcat 5?

Put Foo-1.0. Jar to $CATALINE_HOME/common/endorsed (or any other place where it will be loaded after Foo-2.0. Jar).

Tomcat 5's classloading precedence for webapps is roughly as follows: first the bootstrap/system (JRE/lib, then Tomcat's internal classes), then the webapp libraries (first WEB-INF/classes, then WEB-INF/lib), then the common libraries (first Tomcat/common, then Tomcat/lib) and finally the webapp-shared libraries (Tomcat/shared). So to get Foo-2.0. Jar loaded before Bar-2.0.

Jar, best what you can do is to move Bar-2.0. Jar from WEB-INF/lib to Tomcat/common or Tomcat/shared. The JAR's aren't loaded in alphabetic order of their name.At least, there's no spec which says that.

Renaming them to change the alphabetical filename order makes no sense.

Georgy answered first, so I accepted his submission, but what you describe is exactly what I did to resolve the problem. Your link was especially helpful. I encourage everyone to vote up this answer.

– rcampbell Jan 7 '10 at 16:49 You're welcome. Although I would point out that answers here are not by default ordered by answer date. At the moment of writing you can see at the topright of the user avatar that I answered this question 23 minutes ago and Georgy 15 minutes ago.

You can change the ordering by one of the three tabs oldest, newest and votes righttop of the answers. The default is votes. – BalusC Jan 7 '10 at 17:00 And, in the tooltip you can see the exact time.So I was actually first :o – BalusC Jan 7 '10 at 17:33.

Strip Foo-1.0. Jar out of Bar-2.0.jar. As it is, it's just trouble waiting to happen both for development(need to fudge the dev.

Environments) and for deployment.

I really think this is the best suggestion. Repackage your bar-2.0. Jar, otherwise you are just asking for headaches down the road.

– gregcase May 17 '10 at 19:09.

You don't, as this feature isn't available in Tomcat. If both Foo-1.0. Jar and Foo-2.0.

Jar are needed in the classpath at the same time, you will need some major classpath reorganization. If Bar-2.0 can work with Foo-2.0, then the best thing to do would be to rebuild Bar-2.0 yourself without a Foo-1.0. Jar inside of it.

There is no way to know if Bar-2.0 works with Foo-2.0 or not, and it's a massive, binary-only library with no test cases. – rcampbell Jan 7 '10 at 15:48 I believe the solution you are using has Bar-2.0 running with Foo-2.0, just in a kind of roundabout way. – jsight Jan 8 '10 at 15:09.

It is possible to set the Class-Path in the mainfest of the jar. java.sun.com/developer/Books/javaprogram... I can't really promise it will solve the problem, but can be worth a try.

This is a bit hacky but might work. Change the name of Foo-2.0. Jar to be alphabetically ahead of Bar-2.0.

Jar, say AFoo-2.0.jar.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions