EAR 中非请求但依赖类的类加载说明

发布于 2024-12-08 14:46:25 字数 429 浏览 2 评论 0原文

我正在尝试找出在使用 AXIS 1 和 Commons Logging 的 WAS 6.1 中遇到的问题。我的 EAR 设置为最后一个父级。耳边是 commons-logging、Axis 和使用 Axis 的客户端 jar。客户端 jar 中的类是从 WAR 中调用的。

WAR 调用客户端,客户端调用 axis jar,这需要公共日志记录。但 EAR 似乎并没有从自身加载公共日志记录。看起来commons-logging 是来自WebSphere。

然后 WAR 中的另一个类直接请求公共日志记录,而 EAR 似乎正在加载它。结果我收到此错误: org.apache.commons.logging.impl.LogFactoryImpl 与 org.apache.commons.logging.LogFactory 不兼容

我可以采取什么措施来防止这种情况发生?我对情况的理解有误吗?

I'm trying to track down a problem I'm having in WAS 6.1 with AXIS 1 and Commons Logging. My EAR is set to parent last. In the ear is commons-logging, Axis and a client jar that uses Axis. The classes in the client jar are called from a WAR.

The WAR calls the client, which calls the axis jar, which needs commons-logging. But it does not appear as if the EAR is loading commons-logging from itself. It looks like commons-logging is coming from WebSphere.

Then another class in the WAR directly asks for commons-logging and the EAR appears to be loading it. As a result I'm getting this error: org.apache.commons.logging.impl.LogFactoryImpl incompatible with org.apache.commons.logging.LogFactory

Is there anything I can do to prevent this? Am I reading the situation wrong?

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

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

发布评论

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

评论(1

凹づ凸ル 2024-12-15 14:46:26

由于 commons-logging 和 Axis 1 都内置于 WAS 6.1 中,因此我尝试将它们从 EAR 和 WAR 中完全删除;然后,您可以将类加载器策略设置为默认的“PARENT_FIRST”,这当然更可靠。

您仍然需要 Axis 和 jcl 来编译代码,因此只需将它们从 EAR 中删除即可。如果您使用 Maven,这意味着将它们的范围更改为“提供”,使用 Ant 将为 Ear 任务单独构建 jar 列表,使用 Eclipse EAR 项目 — 从部署程序集中删除适当的 jar。

如果您能提供简短的信息,我将不胜感激。

Since both commons-logging and Axis 1 are built into WAS 6.1, I'd try to remove them from the EAR and WARs entirely; you could then set your classloader policy to the default "PARENT_FIRST", which is certainly more robust.

You'll still need Axis and jcl to compile your code, so only eliminate them from the EAR. If you use Maven, that would mean changing their scope to "provided", with Ant that would be constructing the jar list separately for the ear task, with Eclipse EAR project — removing appropriate jars from the Deployment Assembly.

I'd be grateful for a short info how you did.

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