控制 Tomcat 5 上 WEB-INF/lib 中 jars 的类路径顺序? [英] Control the classpath ordering of jars in WEB-INF/lib on Tomcat 5?

查看:17
本文介绍了控制 Tomcat 5 上 WEB-INF/lib 中 jars 的类路径顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 Tomcat 5.0 中运行的旧版 Web 应用.

I have a legacy web app running in Tomcat 5.0.

这个网络应用在 WEB-INF/lib 中有两个 jar,比如 Foo-2.0.jarBar-2.0.jar.Bar-2.0.jar 实际上包含一个 Foo-1.0.jar 在里面.Bar 也是一个死项目,意味着没有升级,没有源,但对应用程序仍然很重要.

This web app has two jars in WEB-INF/lib, let's say Foo-2.0.jar and Bar-2.0.jar. Bar-2.0.jar actually includes a Foo-1.0.jar inside of it. Bar is also a dead project, meaning no upgrading, no source, but still important to the application.

此应用程序的最新版本需要 Foo-2.0.jar 来处理其他一些内容.在类路径中同时具有 Foo-1.0.jarFoo-2.0.jar 会产生冲突,特别是 ClassDefNotFound 类型的错误,其中后来在 2.0 中添加的类在 1.0 中找不到,等等.

The latest release of this application requires Foo-2.0.jar for some other stuff. Having both Foo-1.0.jar and Foo-2.0.jar in the classpath creates a conflict, specifically a ClassDefNotFound type of error, where a class that was later added in 2.0 cannot be found in 1.0, etc.

在 Eclipse 中,简单的解决方案是右键单击您的 Project,单击 Properties > Java Built Path > Order and导出并将 Foo-2.0.jar 移动到 Bar-2.0.jar 上方,以便首先解决.

In Eclipse, the simple solution is to right click on your Project, click Properties > Java Built Path > Order and Export and to move Foo-2.0.jar above Bar-2.0.jar so it's resolved first.

如何在 Tomcat 的 WEB-INF/lib 中完成这种类型的 jar 类路径排序?

How does one accomplish this type of classpath ordering for jars in WEB-INF/lib in Tomcat?

推荐答案

将 Foo-1.0.jar 放到 $CATALINE_HOME/common/endorsed(或在 Foo-2.0.jar 之后加载的任何其他地方).

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 上 WEB-INF/lib 中 jars 的类路径顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆