如何强制jboss从webapp的lib中的jar加载类 [英] How to force jboss to load classes from jars in webapp's lib

查看:124
本文介绍了如何强制jboss从webapp的lib中的jar加载类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Web应用程序部署在当前已部署在apache tomcat上的jboss-6.0.0Final上. 我有两个罐子,其中每个罐子都包含org.apache.axis相同的包装.我要在<Jboss-home>/server/default/lib&中放入一个罐子<my-app-war>WEB-INF/lib中的另一个jar.

I am trying to deploy my web application on jboss-6.0.0Final, which is currently deployed on apache tomcat. I have two jars one that contains same package which is org.apache.axis. I am putting one jar in <Jboss-home>/server/default/lib & another jar in <my-app-war>WEB-INF/lib.

需要将两个jar都放在类路径中.无法删除其中一个罐子.所以我需要两个罐子都放. &它给了我以下错误

It is required to put both jars in the class path. No way to remove one of the jar. So I need to keep both jars. & It is giving me following error

java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl cannot be cast to org.apache.axis.attachments.Attachments
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.client.Call.invoke(Call.java:1828)

我认为这是由于两个不同的jar中相同类的冲突造成的.

I think it is due to conflict of same classes in two different jars.

现在,我想知道如何强制jboss从/WEB-INF/lib中存在的axis.jar中加载此特定程序包的类.

Now, I want to know the way by which I can force jboss to load classes of this particular package from axis.jar exist in /WEB-INF/lib.

我该怎么做?

推荐答案

我将分享遇到相同情况时遵循的非常简单直接的过程.

I'll share quite simple and straight forward process which I had followed when I came across same situation.

1>创建一个 jboss-web.xml 文件.

  <class-loading java2classloadingcompliance="false">
  <loader-repository>
      com.rts:archive=DTH_PROD.war
      <loader-repository-config>
          java2ParentDelegation=false
      </loader-repository-config>
  </loader-repository>
  </class-loading>
</jboss-web>

积分:

  • 以带有标记的xml开始,该标记在我发布的代码中不可见 检查上面代码的第三行,
  • com.rts -这是您的软件包名称.
  • DTH_PROD.war -您要保留的捆绑包名称
  • Begin the xml with tag which is not visible in the code I'm posting Check 3rd line of above code,
  • com.rts - This is your package name.
  • DTH_PROD.war - Name of bundle you wish to keep

2>现在,将此xml文件放入您的项目的WEB-INF目录中,瞧!!

2> Now place this xml file into WEB-INF directory of your project and voilla!!

更多信息,您可能希望参考这篇文章以获得详细信息.如果您在解决此问题时遇到任何困难,也请在下面评论.

Further more you may wish to refer this article for detailed info. Also comment below if you face any difficulty solving this.

这篇关于如何强制jboss从webapp的lib中的jar加载类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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