How can I use Apache CXF 2.6.7 as dependency of my war project and not CXF that is installed in the modules of JBoss 7.1?

12,206

You should exclude webservices subsystem from being activated for your deployment add this into 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>

or you can go to standalone.xml and remove subsystem there. To do so, you need to remove

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

part of configuration, extension part of on top can stay it wont hurt either way. or you can connect to server with CLI and run

/subsystem=webservices:remove()

In any case I would recommend to read bit about classloading in AS7 https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7

Just a note, exclude-subsystems functionality and deployment-strucure:1.2 was added in 7.1.2 and as such will not work on on 7.1.1.

Share:
12,206
Michael
Author by

Michael

My name is Michael. I am the Lead Security Architect and is responsible for the security and Security Development Lifecycle (SDL) of software products. I have been very passionate about ensuring application security for over 13 years already and evangelizes about application security at various conferences (including OWASP conferences) and security meetups https://ultimatesecurity.pro/. Do not forget to follow me on Twitter @ultimatesecpro

Updated on June 14, 2022

Comments

  • Michael
    Michael almost 2 years

    I am upgrading to JBoss 7.1 and unfortunately I can not deploy my application. I want to use Apache CXF 2.6.7 that is dependency of our war project and not CXF that is installed in the modules of JBoss 7.1. Unfortunately, the deployment of WAR is failing with the following warning and exception:

    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]
    

    My jboss-deployment-structure.xml is the following:

    <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>
    

    How can I solve warnings and errors and to deploy my application?

  • Michael
    Michael over 10 years
    Thanks(+1)! I have read the link and I have tried to exclude modules. Where can I find the list of subsystems provided by Jboss7.1? BTW, Can I remove extensions from the standalone.xml configuration file? <extensions> ... <extension module="org.jboss.as.webservices"/> ... </extensions>
  • Michael
    Michael over 10 years
    Thank you! I was able to do it only by removing subsystem from standalone.xml. Unfortunately when I add <exclude-subsystems> to the jboss-deployment-structure.xml I get the following exception. Do you know why? Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,6] Message: Unexpected content of type 'element start' named '{urn:jboss:deployment-structure:1.1}exclude-subsystems' at org.jboss.as.server.deployment.module.descriptor.JBossDeploy‌​mentStructureParser1‌​1.unexpectedContent(‌​JBossDeploymentStruc‌​tureParser11.java:10‌​98) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
  • Michael
    Michael over 10 years
    Also, I have to comment out the following subsystem in standalone.xml: <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
  • Tomaz Cerar
    Tomaz Cerar over 10 years
    Yes removing subsystem is an option. exclude-subsystem element was added in 7.1.2. I added that note to my answer.
  • Michael
    Michael over 10 years
    Thanks! What is the latest version of Jboss? 7.1.2 or more?
  • Tomaz Cerar
    Tomaz Cerar over 10 years
    Latest version is 7.2.0.Final in 7.x series, or WildFly(renamed project) 8 alpha4, with beta1 coming out shortly.
  • The Coder
    The Coder about 9 years
    I've the same problem, but I need the exact opposite solution, could you please take a look at my question stackoverflow.com/questions/29407115/…
  • The Coder
    The Coder about 9 years
    Does this method utilises cxf jars defined in user deployment or does it utilises the cxf that comes with Jboss?