当 EAR 内时,WAR 在 weblogic 上的加载方式不同,为什么?

发布于 2024-11-25 09:36:24 字数 265 浏览 3 评论 0原文

WebLogic 11g 如何加载 EAR 文件中的库?我的 Web 应用程序遇到了这个问题,当部署为 WAR 时(它依赖于 WEB-INF/lib 中的库),它工作得很好。但是,当它位于 EAR 文件内时,WebLogic 找不到这些库,除非我将它们放在 APP-INF/lib 中。这是否意味着如果我作为 EAR 进行部署,我必须从 WEB-INF/lib 目录中取出所有 JAR 文件并将它们放在 APP-INF/lib 中?或者是否可以在 WebLogic 中进行配置来避免这种情况?

谢谢!

How does WebLogic 11g load libraries in an EAR file? I have this problem with a web application, that when deployed as a WAR (with libraries it depends on in WEB-INF/lib), it works just fine. However, when it's inside an EAR file, WebLogic does not find those libraries unless I put them in APP-INF/lib. Does that mean that if I'm deploying as an EAR I'd have to pull out all JAR files from the WEB-INF/lib directory and place them in APP-INF/lib ? or is there a configuration that can be done in WebLogic to avoid this?

Thanks!

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

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

发布评论

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

评论(2

心碎的声音 2024-12-02 09:36:24

如果您有需要在多个 WAR 文件之间或 WAR 文件和 EAR 文件之间共享的 JAR 文件,那么您需要将它们打包到 EAR 中。

如果 WAR#1 在其 WEB-INF/lib 中有一个 JAR,并且与 WAR#2 一起打包在 EAR 中,那么 WAR#2 将无法看到 WAR#1/WEB-INF/lib 中的 JAR 文件。

If you have JAR files that you need to share between multiple WAR files or between WAR files and EAR files then you will need to package them in the EAR.

If WAR#1 has a JAR in its WEB-INF/lib and is packaged in an EAR with WAR#2, then WAR#2 will not be able to see the JAR files in WAR#1/WEB-INF/lib.

又爬满兰若 2024-12-02 09:36:24

解决您的问题需要了解 Java EE 类加载在容器中的工作原理。您应该查看此链接以获取理解,但基本问题是,当您将应用程序打包为 EAR 时,您已将另一个类加载器(应用程序类加载器)引入到类加载层次结构中。您可以使用 prefer-web-inf-classes 元素。

Solving your problem will take some understanding of how Java EE classloading works in a container. You should look at this link to get an understanding, but the basic problem is that when you package your application as an EAR, you've introduced another classloader (the application classloader) into the class loading hierarchy. You can configure WebLogic to load from your webapp by using the prefer-web-inf-classes element.

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