3 Replies Latest reply on May 23, 2017 10:55 AM by rajesh vyas

    Need help to configure webservices by disabling JBossWs

    Rushikesh Dalvi Newbie

      I am migrating my application from weblogic to WildFly10. I have application specific webservice working in weblogic. Same i am trying to make use of in WildFly. However i am facing issues while deploying application. Error details are as follows

      ISSUE LOG :

       

      \"jboss.undertow.deployment.default-server.default-host./pbmWS\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./pbmWS: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/rcWebServiceContext.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): javax/xml/ws/Endpoint

          Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/rcWebServiceContext.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): javax/xml/ws/Endpoint

          Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/rcWebServiceContext.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): javax/xml/ws/Endpoint

          Caused by: org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): javax/xml/ws/Endpoint

          Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module \\\"deployment.ZL_name.ear:main\\\" from Service Module Loader): javax/xml/ws/Endpoint\"

      jboss-deployment-structure.xml:

      <jboss-deployment-structure>

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

          <deployment>

        <exclude-subsystems>

        <subsystem name="webservices" />

        <subsystem name="jaxrs" />

      <subsystem name="weld" />

        </exclude-subsystems>

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

              <exclusions>

                  <module name="org.slf4j" />

                  <module name="org.slf4j.impl" />

              </exclusions>

          </deployment>

      </jboss-deployment-structure>

      EAR Structure:

      ZLName.ear

      META-INF

      jboss-deployment-structure.xml:

      jboss-app.xml (lib path set to APP-INF/lib)

      APP-INF

      lib

      rcWebService-D_RC_ZAAS.war

      META-INF

      added in manifest Dependencies: org.apache.cxf

      WEB-INF

      rcWebServiceContext.xml

      rcWebServiceContext.xml:

       

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

      <beans xmlns="http://www.springframework.org/schema/beans"

      xmlns:p="http://www.springframework.org/schema/p"

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

      xmlns:jaxws="http://cxf.apache.org/jaxws"

      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

      http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

       

       

      <!-- Load CXF modules from cxf.jar -->

          <import resource="classpath:META-INF/cxf/cxf.xml" />

          <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

          <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

       

       

      <jaxws:endpoint

         id="rcWebService"

         implementor="com.zl.mirev.webservices.MiRevWebServiceImpl"

         address="/checkEligibility" />

        

      </beans>

        • 1. Re: Need help to configure webservices by disabling JBossWs
          Alessio Soldano Master

          The webservices subsystem is properly excluded, assuming that's what you're really trying to do and you know what you're doing. However, by excluding the webservices subsystem, you're also preventing the jaxws apis from being exported to your deployment. So you likely need to provide the required jaxws api libs. Generally speaking, if you have doubts, please read Chapter 5. Advanced User Guide

          • 2. Re: Need help to configure webservices by disabling JBossWs
            rajesh vyas Newbie

            I also have exact same problem. We have JBoss EAP 7. In my project CXF is used for JAX-RS (rest services only) and JAX-WS (soap client only) and i want to disable webservices sub-system so that can use embedded cxf.

            I've got all required libraries/dependencies defined in pom.xml. I'm surprised to see that no solution available on stackoverflow or jboss developer forum, since this doesn't sound like a unique requirement when you want to override the server jars with your pom.xml dependencies. Also I went through all the documentation available for JBoss EAP 7 and nothing is useful including the link mentioned in above post ( Chapter 5. Advanced User Guide)

             

            I get below error after disabling it-

             

            13:58:08,681 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 66) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./someapplication: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./someapplication: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-context.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): javax/xml/ws/Endpoint

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

              at java.util.concurrent.FutureTask.run(FutureTask.java:266)

              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)

              at org.jboss.threads.JBossThread.run(JBossThread.java:320)

            Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-context.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): javax/xml/ws/Endpoint

              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:231)

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)

              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)

              ... 6 more

            Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-context.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): javax/xml/ws/Endpoint

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)

              at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)

              at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)

              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)

              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)

              at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)

              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)

              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)

              at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)

              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)

              ... 8 more

            Caused by: org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): javax/xml/ws/Endpoint

              at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:140)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1406)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)

              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:168)

              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:138)

              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)

              ... 23 more

            Caused by: java.lang.NoClassDefFoundError: Failed to link org/apache/cxf/jaxws/spring/EndpointDefinitionParser$SpringEndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): Failed to link org/apache/cxf/jaxws/EndpointImpl (Module "deployment.someapplication_code_formatting.war:main" from Service Module Loader): javax/xml/ws/Endpoint

              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:422)

              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.apache.cxf.jaxws.spring.EndpointDefinitionParser.<clinit>(EndpointDefinitionParser.java:53)

              at org.apache.cxf.jaxws.spring.NamespaceHandler.init(NamespaceHandler.java:36)

              at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:131)

              ... 30 more

            • 3. Re: Need help to configure webservices by disabling JBossWs
              rajesh vyas Newbie

              For anyone else who is facing above issue. Here is the solution. Add below dependency in pom/classpath-

               

                  <dependency>

                    <groupId>javax.xml.ws</groupId>

                    <artifactId>jaxws-api</artifactId>

                    <version>2.2.9</version>

                  </dependency>

               

              javax.xml.ws.Endpoint is available in JBoss modules jar. During deployment conflict arises since it's in a different module and you've removed webservices dependency so webapp classloader doesn't see it (I'm assuming classloader look up hierarchy is another issue here since this class is available as part of JDK, ideally JBoss should have honored JDK classpath).