9 Replies Latest reply on Jul 21, 2017 7:58 AM by Ulab S

    Using CXF2.7.0 build with WAR in WildFly 10

    Prabahar Duraisamy Newbie

      I have WAR module that uses CXF 2.7.0 library to generate client code (I can't upgrade to use WildFly 10 provided 3.1.4) right now for timing issues. So in order to pick the CXF from WEB-IN\lib folder, I have added following:

       

      jboss-deployment-structure.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

         

          <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

            <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

           

            <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

            <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

          <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="jaxrs" />

                  <subsystem name="resteasy" />

              </exclude-subsystems>

             

              <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

              <exclusions>

                       <!-- Exclude Version cxf of JBOSS -->

                        <module name="org.apache.cxf" />

                        <!-- Exclude JAVA EE of JBOSS (javax.ws..) => Add dependency javax.annotation -->

                        <module name="javaee.api" />

       

                        <!-- Exclude RestEasy conflict (javax.ws.rs.ext.RunDelegate) -->

                        <module name="org.jboss.resteasy.resteasy-jackson-provider" />

       

                         <module name="org.jboss.as.jaxrs"/>

                         <module name="org.jboss.resteasy.resteasy-jaxrs"/>

                         <module name="org.jboss.resteasy.resteasy-cdi"/>

                         <module name="org.jboss.resteasy.jackson-provider"/>

                         <module name="org.jboss.resteasy.resteasy-atom-provider"/>

                         <module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider"/>

                         <module name="org.jboss.resteasy.resteasy-jaxb-provider"/>

                         <module name="org.jboss.resteasy.resteasy-jettison-provider"/>

                         <module name="org.jboss.resteasy.resteasy-jsapi"/>

                         <module name="org.jboss.resteasy.resteasy-multipart-provider"/>

                         <module name="org.jboss.resteasy.resteasy-yaml-provider"/>

                         <module name="org.codehaus.jackson.jackson-core-asl"/>

                         <module name="org.codehaus.jackson.jackson-jaxrs"/>

                         <module name="org.codehaus.jackson.jackson-mapper-asl"/>

                         <module name="org.codehaus.jackson.jackson-xc"/>

                         <module name="org.codehaus.jettison"/>

                         <module name="javax.ws.rs.api"/>

              </exclusions>

          </deployment>

      </jboss-deployment-structure>

       

      web.xml

       

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

          id="WebApp_ID" version="2.5">

          <display-name>Comcast Web</display-name>

          <welcome-file-list>

              <welcome-file>index.jsp</welcome-file>

          </welcome-file-list>

       

            <servlet>

              <description></description>

              <display-name>content</display-name>

              <servlet-name>contentServlet</servlet-name>

              <servlet-class>com.allconnect.comcast.quartz.ContentServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

          </servlet>

         

          <servlet-mapping>

              <servlet-name>contentServlet</servlet-name>

              <url-pattern>/content</url-pattern>

          </servlet-mapping>

      </web-app>

       

      Below is the stake trace i am getting during the deployment. Could someone can point me if I need to add anything to module exclusion list? Thanks

       

      log trace

       

      2016-03-01 06:55:14,784 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.2.3.Final

      2016-03-01 06:55:15,032 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider in Module "deployment.cxf-web-0.0.1-SNAPSHOT.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider (Module "deployment.cxf-web-0.0.1-SNAPSHOT.war:main" from Service Module Loader): javax/xml/ws/Provider

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

          at org.jboss.modules.Module.loadModuleClass(Module.java:605)

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:254)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:166)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

          at java.lang.Thread.run(Thread.java:745)

       

      2016-03-01 06:55:15,037 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "cxf-web-0.0.1-SNAPSHOT.war"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

          at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider (Module "deployment.cxf-web-0.0.1-SNAPSHOT.war:main" from Service Module Loader): javax/xml/ws/Provider

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

          at org.jboss.modules.Module.loadModuleClass(Module.java:605)

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:254)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:166)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)

          ... 5 more

       

      2016-03-01 06:55:15,061 ERROR [org.jboss.as.controller.management-operation] (management task-8) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "cxf-web-0.0.1-SNAPSHOT.war")]) - failure description: {

          "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"cxf-web-0.0.1-SNAPSHOT.war\"

          Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider (Module \"deployment.cxf-web-0.0.1-SNAPSHOT.war:main\" from Service Module Loader): javax/xml/ws/Provider"},

          "WFLYCTL0180: Services with missing/unavailable dependencies" => [

              "jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".batch.environment is missing [jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".beanmanager]",

              "jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".beanmanager]"

          ]

      }

      2016-03-01 06:55:15,066 ERROR [org.jboss.as.server] (management task-8) WFLYSRV0021: Deploy of deployment "cxf-web-0.0.1-SNAPSHOT.war" was rolled back with the following failure message:

      {

          "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"cxf-web-0.0.1-SNAPSHOT.war\"

          Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider (Module \"deployment.cxf-web-0.0.1-SNAPSHOT.war:main\" from Service Module Loader): javax/xml/ws/Provider"},

          "WFLYCTL0180: Services with missing/unavailable dependencies" => [

              "jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".batch.environment is missing [jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".beanmanager]",

              "jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"cxf-web-0.0.1-SNAPSHOT.war\".beanmanager]"

          ]

      }

      2016-03-01 06:55:15,073 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 61) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'cxf-web-0.0.1-SNAPSHOT.war#transactionalUnit'

      2016-03-01 06:55:15,073 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 62) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'cxf-web-0.0.1-SNAPSHOT.war#logicalUnit'

      2016-03-01 06:55:15,338 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0028: Stopped deployment cxf-web-0.0.1-SNAPSHOT.war (runtime-name: cxf-web-0.0.1-SNAPSHOT.war) in 272ms

      2016-03-01 06:55:15,339 INFO  [org.jboss.as.controller] (management task-8) WFLYCTL0183: Service status report

      WFLYCTL0184:    New missing/unsatisfied dependencies:

            service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".beanmanager (missing) dependents: [service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".batch.environment, service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".weld.weldClassIntrospector]

      WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."cxf-web-0.0.1-SNAPSHOT.war".INSTALL

        • 1. Re: Using CXF2.7.0 build with WAR in WildFly 10
          Ivan Digber Newbie

          Hi, have you been able to get any support or resolution to the issue above? I am currently facing the same problem and unsure on how to resolve it.

           

          Thanks in advance.

          • 2. Re: Using CXF2.7.0 build with WAR in WildFly 10
            Alessandro Modolo Newbie

            I've the same issue with CXF 3.1.1. Did you've found any solution?

             

            Thanks

            Alessandro

            • 3. Re: Using CXF2.7.0 build with WAR in WildFly 10
              Tomaz Cerar Master

              problem is simple you need

              <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

                  <deployment>

                      <exclude-subsystems>

                          <subsystem name="jaxrs" />

                          <subsystem name="webservices" />

                      </exclude-subsystems>

                  </deployment>

              </jboss-deployment-structure>

               

              and noting else in your jboss-deployment-structure.xml

              • 4. Re: Using CXF2.7.0 build with WAR in WildFly 10
                Alessandro Modolo Newbie

                Thanks for response,

                Modifying the jboss-deployment-structure.xml as you suggested doesn't resolve the problem.

                I've check my custom library set and i can't figure out why the AS gives me that error...i've already included the cxf-rt-ws-security-3.1.1.jar (which contains the org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider) in my WEB-INF lib folder.

                • 5. Re: Using CXF2.7.0 build with WAR in WildFly 10
                  Reto Hodel Newbie

                  I could fix this problem, by doing 3 things:

                  1. As you already did: exclude the subsystems webservices and jaxrs.

                  2. Adding the cxf-rt-ws-security lib to my project (e.g. maven dependency with scope compile)

                  3. Adding two module dependencies in the jboss-deployment-structure.xml: java.xml.ws.api (which actually contains the Provider interface) and javax.jws.api

                   

                  So my file looked like this:

                   

                  <jboss-deployment-structure>

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                         <deployment>

                            <exclude-subsystems>

                                 <subsystem name="webservices" />

                                 <subsystem name="jaxrs" />

                            </exclude-subsystems>

                            <dependencies>

                                 <module name="javax.xml.ws.api" export="true" />

                                 <module name="javax.jws.api" export="true" />

                            </dependencies>

                       </deployment>

                  </jboss-deployment-structure>

                   

                  Hope this helps!

                  1 of 2 people found this helpful
                  • 6. Re: Using CXF2.7.0 build with WAR in WildFly 10
                    srikanth gujarathi Newbie

                    Hi Reto Hodel,

                     

                    Environment :JBoss EAP 7.0.0

                     

                    It worked for me , my application got deployed after following your resolving steps.

                     

                     

                    Thanks,

                    Srikanth Gujarathi.

                    • 7. Re: Using CXF2.7.0 build with WAR in WildFly 10
                      Xunhua TEng Newbie

                      Thanks a lot.

                       

                      I did migration from EAP6 TO EAP 7 facing the same issue and followed your guide, it solved my problem, in EAP6 , it does not need jboss-deployment-structure.xml, but for EAP7, have to put this file, otherwise gave me the error  NoClassFound .....

                       

                      Hope this can help other people.

                      • 8. Re: Using CXF2.7.0 build with WAR in WildFly 10
                        Ulab S Newbie

                        In Wildfly 10.1 ,

                         

                            Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/transport/servlet/CXFServlet (Module \"deployment.ws.ear" from Service Module Loader): org/springframework/context/ApplicationListener"}

                         

                        after changing to below , still error

                         

                            Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/transport/servlet/CXFServlet (Module \"org.apache.cxf.impl:main\" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /usr/local/ws/modules,/usr/local/ws/modules/system/layers/base))): org/springframework/context/ApplicationListener"},

                         

                        any ideas ?

                         

                        <deployment>
                        <exclude-subsystems>
                        <subsystem name="webservices" />
                        <subsystem name="jaxrs" />
                        </exclude-subsystems>
                        <dependencies>
                        <module name="javax.xml.ws.api" export="true" />
                        <module name="javax.jws.api" export="true" />
                        <module name="org.apache.cxf" export="true">
                        <imports>
                        <include path="META-INF**" />
                        <include path="META-INF/cxf**" />
                        </imports>
                        </module>
                        <module name="org.apache.cxf.impl" export="true">
                        <imports>
                        <include path="META-INF**" />
                        <include path="META-INF/cxf**" />
                        </imports>
                        </module>
                        <module name="org.springframework.spring" optional="true">
                        <imports>
                        <include path="META-INF" />
                        </imports>
                        </module>
                        </dependencies>
                        </deployment>
                        
                        • 9. Re: Using CXF2.7.0 build with WAR in WildFly 10
                          Ulab S Newbie

                          Actually, there is no need to provide cxf and spring entries in jboss-deployment-structure.xml,  By default if the ear pom.xml dependecies are loaded in the classpath.

                          So define it in ear/pom.xml and it built in lib directory of ear. By Wildfly Classloading mechanism, those jars are in classpath and can be accessed by war or ejb inside the ear.

                           

                          1. <deployment> 
                          2. <exclude-subsystems> 
                          3. <subsystem name="webservices" /> 
                          4. <subsystem name="jaxrs" /> 
                          5. </exclude-subsystems> 
                          6. <dependencies> 
                          7. <module name="javax.xml.ws.api" export="true" /> 
                          8. <module name="javax.jws.api" export="true" /> 
                          9. </dependencies> 
                          10. </deployment>