简体   繁体   English

Jboss中的Axis2.jar冲突

[英]Axis2.jar conflict in Jboss

I have a problem deploying an Axis 2 web application. 我在部署Axis 2 Web应用程序时遇到问题。 I'm using Jboss 4.2.0, that already has a web application that makes use of an Axis 2 client. 我正在使用Jboss 4.2.0,它已经具有一个使用Axis 2客户端的Web应用程序。 This Axis 2 application that I'm trying to deploy is actually an archive service (with an .aar extension), which is put inside the "services" folder in the Axis 2 web application. 我要部署的Axis 2应用程序实际上是一个存档服务(扩展名为.aar),该服务放置在Axis 2 Web应用程序的“ services”文件夹中。 The latter is then built using an ant builder, and the resulting .war file is what I'm deploying. 然后使用蚂蚁生成器构建后者,然后生成的.war文件就是我正在部署的文件。 Now when I remove the older application from Jboss' deploy folder, my new application works just fine. 现在,当我从Jboss的deploy文件夹中删除较旧的应用程序时,我的新应用程序可以正常工作。 But when I redeploy the old application again, I get the following exception from Jboss: 但是,当我再次重新部署旧应用程序时,我从Jboss得到以下异常:

13:58:44,382 INFO  [AxisServlet] org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
13:58:44,383 ERROR [[/axis2]] Servlet /axis2 threw load() exception
org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
        at org.apache.axis2.engine.AxisConfiguration.engageModule(AxisConfiguration.java:464)
        at org.apache.axis2.engine.AxisConfiguration.engageGlobalModules(AxisConfiguration.java:591)
        at org.apache.axis2.deployment.DeploymentEngine.engageModules(DeploymentEngine.java:615)
        at org.apache.axis2.deployment.WarBasedAxisConfigurator.engageGlobalModules(WarBasedAxisConfigurator.java:301)
        at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:81)
        at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516)
        at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4069)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4373)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
        at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
        at org.jboss.web.WebModule.startModule(WebModule.java:83)
        at org.jboss.web.WebModule.startService(WebModule.java:61)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
        at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:417)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy45.start(Unknown Source)
        at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
        at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
        at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:93)
        at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
        at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy46.start(Unknown Source)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy9.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)

My guess is that Jboss is conflicting between the axis2-1.4.1.jar file that exists within the .ear of the older application, and the axis2.jar of the Axis 2 web application that I'm trying to deploy. 我的猜测是,Jboss在旧应用程序的.ear中存在的axis2-1.4.1.jar文件与我要部署的Axis 2 Web应用程序的axis2.jar之间发生冲突。 Does anyone have a solution for my problem? 有人能解决我的问题吗?

I was able to solve the problem. 我能够解决问题。 My initial assumption was correct: My problem was that when deploying the .ear project first which contains the axis2-1.4.1.jar jar file, the classloader of the application was registering itself as the classloader that's capable of loading all the classes that are found in the .jar file, since no other classloader is able to serve those classes. 我最初的假设是正确的:我的问题是,当首先部署包含axis2-1.4.1.jar jar文件的.ear项目时,应用程序的类加载器将自身注册为能够加载所有类的类加载器。在.jar文件中找到,因为其他类加载器无法提供这些类。 ( you could check the following links for more clarifications: 1">http://thorgull.be/doku.php?id=tutorials:jboss:classloaderisolation#fnt_1 http://community.jboss.org/wiki/JBossClassLoadingUseCases ) (您可以检查以下链接以获得更多说明:1“> http://thorgull.be/doku.php?id=tutorials:jboss:classloaderisolation#fnt_1 http://community.jboss.org/wiki/JBossClassLoadingUseCases)

To solve the problem, I have created a jboss-app.xml file (Since it's a .ear project), and added the following: 为了解决该问题,我创建了一个jboss-app.xml文件(因为它是一个.ear项目),并添加了以下内容:

<?xml version="1.0" encoding="UTF-8" ?>
 <jboss-app>
  <loader-repository>
   mypackage:loader="myapplication.ear"
  </loader-repository>
 </jboss-app>

With this change, a separate child repository will be created for my .ear application (This is called isolated mode). 进行此更改后,将为我的.ear应用程序创建一个单独的子存储库(这称为隔离模式)。 This will fix any problems that someone might encounter from having different versions of the same packages/classes, trying to run on the same instance of Jboss. 这将解决由于尝试在同一Jboss实例上运行具有相同软件包/类的不同版本而可能遇到的任何问题。

Another solution that might be easier but doesn't offer much control on what applications to isolate and which ones should delegate to the root repository of packages/classes is by modifying the ear-deployer.xml (Found in your deploy folder), and setting the following XML element: 另一个解决方案可能更简单,但对要隔离的应用程序以及应该委托给程序包/类的根存储库的应用程序控制不大的方法是修改ear-deployer.xml(在deploy文件夹中找到),然后设置以下XML元素:

<attribute name="Isolated">false</attribute>

to true . 真实地

Make sure to read the references that I have included in my post, to better understand how classloaders work. 确保阅读我的帖子中包含的参考,以更好地了解类加载器的工作方式。

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM