如何使用Apache CXF 2.6.7作为我的war项目的依赖,而不是安装在JBoss 7.1模块中的CXF?

时间:2013-09-10 09:00:35

标签: jboss jboss7.x

我正在升级到JBoss 7.1,不幸的是我无法部署我的应用程序。 我想使用Apache CXF 2.6.7,它是我们的war项目的依赖,而不是安装在JBoss 7.1模块中的CXF。 不幸的是,WAR的部署失败了,出现以下警告和异常:

10:39:39,511 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5)  JBAS015876: Starting deployment of "example.war"
10:39:49,021 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jaxb-api.jar in "/example.war/WEB-INF/lib/jaxb-impl-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,024 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry activation.jar in "/example.war/WEB-INF/lib/jaxb-impl-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,025 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jsr173_1.0_api.jar in "/example.war/WEB-INF/lib/jaxb-impl-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,027 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jaxb1-impl.jar in "/example.war/WEB-INF/lib/jaxb-impl-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,029 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jaxb-api.jar in "/example.war/WEB-INF/lib/jaxb-xjc-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,031 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jaxb-impl.jar in "/example.war/WEB-INF/lib/jaxb-xjc-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,033 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry jsr173_1.0_api.jar in "/example.war/WEB-INF/lib/jaxb-xjc-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,035 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry activation.jar in "/example.war/WEB-INF/lib/jaxb-xjc-2.2.5.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,038 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry activation.jar in "/example.war/WEB-INF/lib/mail-1.4.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,041 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry xml-apis.jar in "/example.war/WEB-INF/lib/serializer-2.7.1.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,047 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry xercesImpl.jar in "/example.war/WEB-INF/lib/xalan-2.7.0.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,049 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry xml-apis.jar in "/example.war/WEB-INF/lib/xalan-2.7.0.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,050 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-16)  Class Path entry serializer.jar in "/example.war/WEB-INF/lib/xalan-2.7.0.jar"  does not point to a valid jar for a Class-Path reference.
10:39:49,127 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-10)  JBAS015893: Encountered invalid class name 'org.springframework.context.ApplicationContext,org.springframework.beans.BeansException' for service type 'org.apache.cxf.bus.factory'
10:39:49,805 WARN  [org.jboss.as.ee] (MSC service thread 1-4)  JBAS011006: Not installing optional component org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation
    at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606)
    at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]

10:39:49,826 WARN  [org.jboss.as.ee] (MSC service thread 1-4)  JBAS011006: Not installing optional component org.eclipse.jetty.continuation.Servlet3Continuation$1 due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.eclipse.jetty.continuation.Servlet3Continuation$1
    at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606)
    at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]

10:39:49,854 WARN  [org.jboss.as.ee] (MSC service thread 1-4)  JBAS011006: Not installing optional component org.eclipse.jetty.continuation.Servlet3Continuation$2 due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.eclipse.jetty.continuation.Servlet3Continuation$2
    at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606)
    at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]

我的jboss-deployment-structure.xml如下:

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.jboss.as.jmx"/>
        </dependencies>

        <exclusions>
            <module name="javaee.api" />
            <module name="org.hibernate"/>
            <module name="javax.xml.bind.api"/>
            <module name="org.apache.cxf"/>
            <module name="org.jboss.ws.api"/>
            <module name="jorg.jboss.ws.spi"/>
            <module name="com.sun.xml.bind"/>
            <module name="org.apache.xalan"/>
            <module name="javax.mail.api"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure>

如何解决警告和错误以及部署我的应用程序?

2 个答案:

答案 0 :(得分:9)

您应该排除为部署激活webservices子系统 将其添加到META-INF / jboss-deployment-structure.xml

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
     <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
     <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
     <exclude-subsystems>
        <subsystem name="webservices" />
    </exclude-subsystems>
  <deployment>
 </jboss-deployment-structure>

或者您可以转到standalone.xml并删除子系统。 为此,您需要删除

<subsystem xmlns="urn:jboss:domain:webservices:1.x">
...
...
<subsystem>

配置的一部分,顶部的扩展部分可以保持它不会伤害任何方式。 或者您可以使用CLI连接到服务器并运行

/subsystem=webservices:remove()

无论如何,我建议在AS7 https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7

中阅读有关类加载的内容

只是注意,排除子系统功能和部署结构:在7.1.2中添加了1.2,因此在7.1.1上不起作用。

答案 1 :(得分:0)

我可以在Jboss-7.1.1.Final上使用Spring 3.1.2在CXF-2.7.14上部署Ear / War。我列出的变化如下:

The following libraries are added 
  • CXF-2.7.14.jar,wss4j-1.6.17.jar,neethi-3.0.3.jar, Geronimo的WS-metadata_2.0_spec-1.1.1.jar, ord.apache.servicemix.bundles.saaj-impl-1.3.18_1.jar,wsdl4j-1.6.3.jar, woodstox-core-asl-4.4.1.jar,xmlsec-1.5.7.jar

在jboss-deployment-structure.xml文件中添加如下所示:

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="com.sun.xml.messaging.saaj" export="true" />
        </dependencies>
        <exclusions>
            <module name="org.apache.log4j"/>
            <module name="org.slf4j" />
            <module name="org.apache.commons.logging"/>
            <module name="org.log4j"/>  
            <module name="org.jboss.logging"/>          
        </exclusions>
    </deployment>
    <sub-deployment name="project.webapp.war">
        <exclusions>
            <module name="org.apache.log4j"/>
            <module name="org.slf4j" />
            <module name="org.apache.commons.logging"/>
            <module name="org.log4j"/>  
            <module name="org.jboss.logging"/>          
        </exclusions>
    </sub-deployment>
</jboss-deployment-structure>

我可以毫无问题地部署。希望它能帮助别人。