EAR中针对非请求但依赖类的类加载的说明 [英] Explanation of class loading in an EAR for non-requested but dependent class

查看:184
本文介绍了EAR中针对非请求但依赖类的类加载的说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AXIS 1和Commons Logging来跟踪我在WAS 6.1中遇到的问题。我的EAR设置为父级。在耳中是commons-logging,Axis和使用Axis的客户端jar。客户端jar中的类是从WAR调用的。

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.

WAR调用客户端,该客户端调用轴jar,需要进行commons-logging。但是,看起来好像EAR正在从自身加载公共记录。看起来commons-logging来自WebSphere。

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.

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

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?

推荐答案

由于公共日志和Axis 1都内置在WAS 6.1中,我试试完全从EAR和WAR中删除它们;然后你可以将你的类加载器策略设置为默认的PARENT_FIRST,这肯定会更健壮。

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.

你仍然需要Axis和jcl来编译你的代码,所以只有从EAR中消除它们。如果您使用Maven,这意味着将其范围更改为已提供,Ant将为ear任务单独构建jar列表,​​使用Eclipse EAR项目—从部署程序集中删除适当的jar。

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.

这篇关于EAR中针对非请求但依赖类的类加载的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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