Tomcat jar 加载

发布于 2024-10-08 05:27:42 字数 152 浏览 0 评论 0原文

我在 GWT 中创建了一个 Web 应用程序并将其部署在 Tomcat 中。我需要从 WEB-INF/lib 中分离出一些 jars(第三方 jars)并将它们放在 Tomcat 设置之外的文件夹中。请帮助我了解如何进行适当的更改,以便在启动 tomcat 服务器时加载这些第三方 jar。

I have created a web app in GWT and deployed it in Tomcat. I need to separate out some jars(Third party jars) from WEB-INF/lib and place them in a folder outside Tomcat setup. Please help me as of how to make appropriate changes so that on starting tomcat server those third party jars are loaded.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-10-15 05:27:42

在 Tomcat6 中,您可以将共享 jar 放在 $CATALINA_HOME/lib 中,所有 Web 应用程序都可以看到它。

正如文档明确指出

因此,从一个角度来看
Web 应用程序、类或资源
加载看起来如下
存储库,按此顺序:

JVM 的引导类

系统类加载器类(描述
上)

/WEB-INF/您的网站的类别
应用程序

/WEB-INF/lib/*.jar 您的网站
应用程序

$CATALINA_HOME/lib

$CATALINA_HOME/lib/*.jar

因此,如果您的 web-inf/lib 中有相同的 jar,它将首先从那里加载。确保删除重复项。

In Tomcat6, you can place shared jars in $CATALINA_HOME/lib and it will be visible to all the web apps.

As the docs clearly state,

Therefore, from the perspective of a
web application, class or resource
loading looks in the following
repositories, in this order:

Bootstrap classes of your JVM

System class loader classes (described
above)

/WEB-INF/classes of your web
application

/WEB-INF/lib/*.jar of your web
application

$CATALINA_HOME/lib

$CATALINA_HOME/lib/*.jar

So if you have the same jar within your web-inf/lib, it will get loaded from there first. Ensure you remove duplicates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文