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

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

问题描述

我有一个在Tomcat 5.0中运行的遗留Web应用程序。

I have a legacy web app running in Tomcat 5.0.

此Web应用程序在 WEB-INF / lib 中有两个jar,让我们一起来说 Foo-2.0.jar Bar-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.jar Foo-2.0.jar 会产生冲突,特别是 ClassDefNotFound 类型的错误,其中a后来在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 ,单击属性> Java内置路径> 订购和导出并在上方移动 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.

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

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

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