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

后端 未结 7 798
终归单人心
终归单人心 2020-12-10 05:48

I have a legacy web app running in Tomcat 5.0.

This web app has two jars in WEB-INF/lib, let\'s say Foo-2.0.jar and Bar-2.0.jar

相关标签:
7条回答
  • 2020-12-10 06:27

    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.

    0 讨论(0)
  • 2020-12-10 06:34

    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.

    0 讨论(0)
  • 2020-12-10 06:36

    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.

    0 讨论(0)
  • 2020-12-10 06:43

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

    0 讨论(0)
  • 2020-12-10 06:45

    To have Foo-2.0.jar before Bar-2.0.jar, update the Bar-2.0.jar with the content of Foo-2.0.jar (overwrite already contained .class)and delete Foo-2.0.jar from the war.

    -cp A.jar:B.jar has the effect, that content of A.jar is like a layer over B.jar. So you get the same effect with overwriting B.jar's content with A.jar's.

    0 讨论(0)
  • 2020-12-10 06:47

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

    0 讨论(0)
提交回复
热议问题