Sun Application Server 中的 EJB 依赖项版本冲突

发布于 2024-09-06 12:14:11 字数 562 浏览 9 评论 0原文

总结一下我遇到的问题,我有一个 EJB,它使用库的版本 A(我们称之为 dep-vA.jar)。 dep-vA.jar 打包在 EJB jar 文件的根目录中。应用程序服务器中的域 lib 文件夹包含同一库的版本 B(我们将其称为 dep-vB.jar)。调用 EJB 时,由于加载了 dep-vB.jar 文件而不是 dep-vA.jar,我收到错误。

我想这个问题的第一部分是,Sun One Application Server v9.1 是否将 EJB 彼此隔离?我的印象是确实如此。但似乎另一个应用程序加载了 dep-vB.jar 并且该 EJB 直接使用它而没有加载自己的应用程序。

第二个问题是,如果应用程序服务器确实隔离了 EJB,那么它是否会在查看应用程序服务器的 lib 文件夹之前从 EJB 的 jar 文件加载依赖项?我的印象是这也是正确的,但也许不是...

是否有人足够熟悉Sun应用程序服务器来解释为什么加载dep-vB.jar而不是dep-vA.jar?有什么方法可以让它加载 dep-vA.jar 而不更改应用程序服务器的 lib 文件夹中的内容? (我会犹豫是否做任何可能影响服务器上其他应用程序的事情)

谢谢。

To summarize the issue I'm encountering, I have an EJB which uses version A of a library (let's call it dep-vA.jar). dep-vA.jar is packaged in the root of the EJB's jar file. The domain lib folder in the application server contains version B of the same library (let's call it dep-vB.jar). When calling the EJB, I get an error due to dep-vB.jar file being loaded rather than dep-vA.jar.

I guess the first part of this question is, does Sun One Application Server v9.1 isolate EJBs from each other? I was under the impression that it does. But it seems like another application loaded dep-vB.jar and this EJB is directly using it without loading its own.

The second question is, if the app server does isolate EJBs, does it load dependencies from the EJB's jar file before looking in the application server's lib folders? I was under the impression that this is also true, but maybe not...

Is anyone familiar enough with Sun application servers to explain why dep-vB.jar is being loaded rather than dep-vA.jar? Is there any way to get it to load dep-vA.jar without changing what's in the application server's lib folders? (I would hesitate to do anything that might affect other applications on the server)

Thanks.

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

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

发布评论

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

评论(2

月隐月明月朦胧 2024-09-13 12:14:11

我想这个问题的第一部分是,Sun One Application Server v9.1 是否将 EJB 彼此隔离?我的印象是确实如此。但似乎另一个应用程序加载了 dep-vB.jar 并且该 EJB 直接使用它而没有加载自己的应用程序。

根据 Sahoo(GlassFish 开发人员),< em>Java EE 规范强制要求单耳模块之间的类加载隔离,因此一个应用程序服务器与另一个应用程序服务器的行为可能不同。对于 Sun ONE,我对 的理解文档 的特点是 EJB-JAR 是隔离的。

第二个问题是,如果应用程序服务器确实隔离了 EJB,那么它是否会在查看应用程序服务器的 lib 文件夹之前从 EJB 的 jar 文件加载依赖项?我的印象是这也是真的,但也许不是......

这是一种家长优先的策略(据我所知,Sun ONE 允许更改仅适用于 Web 应用程序的委派模式)。

话虽这么说,如果您在 EJB 的 MANIFEST.MFClass-Path 条目中列出 dep-vA.jar,会发生什么情况?罐?

另请参见

I guess the first part of this question is, does Sun One Application Server v9.1 isolate EJBs from each other? I was under the impression that it does. But it seems like another application loaded dep-vB.jar and this EJB is directly using it without loading its own.

According to Sahoo (which is a GlassFish developer), the Java EE spec does not mandate class loading isolation among modules of a single ear so the behavior can be different from one app server to another. With Sun ONE, my understanding of the documentation is that EJB-JARs are isolated.

The second question is, if the app server does isolate EJBs, does it load dependencies from the EJB's jar file before looking in the application server's lib folders? I was under the impression that this is also true, but maybe not...

It's a parent-first strategy (and to my knowledge, Sun ONE allows to change the delegating mode for webapps only).

That being said, what happens if you list dep-vA.jar in the Class-Path entry of the MANIFEST.MF of the EJB-JAR?

See also

沧桑㈠ 2024-09-13 12:14:11

我没有使用过那个特定的服务器,但我知道在 WebSphere 中,有一个选项可以使用 PARENT_FIRST 或 PARENT_LAST 类加载。您将寻找 PARENT_LAST 的等效项,其中类首先从 EAR 加载,然后再加载到服务器。

我假设这样的配置在任何应用程序服务器中都是可能的,因为您应该始终能够强制您的应用程序特定的 jar 加载到任何其他应用程序服务器上。

I haven't used that particular server, but I do know that in WebSphere, there is an option to use PARENT_FIRST or PARENT_LAST classloading. You would be looking for an equivalent of PARENT_LAST where the classes are loaded from the EAR first before going up to the server.

I would assume that such a configuration is possible in any app server, as you should always be able to enforce your application specific jars to be loaded over any others.

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