3 Replies Latest reply on Jul 7, 2011 11:17 AM by amberjboss1999

    Jbossws-cxf integration (jbossws-cxf-bin-dist) ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    amberjboss1999

      I installed Jbossws-cxf integration (jbossws-cxf-bin-dist) and ran ant -Dspring=true deploy-jboss600  -Djboss.server.instance=default for jboss-6.0.0.Final and Jdk6.0, started Jboss6 and I get

      "ClassNotFoundException: org.springframework.web.context.ContextLoaderListener".

      I thought by specifying "-Dspring=true" will install all the spring libs; what else do I need to do?

      ContextLoaderListener should be in spring-web, and from the log of the ant script, it doesn't look like there is one installed in Jboss libs, what is going on please?

      I attached the output of the ant scripts as well, thanks in advance!

       

       

       

      installed my web services whose web.xml looks like this:

       

       

      <display-name>ISD</display-name>

                <!-- http://localhost:8080/ISD/services/threepar?wsdl  -->

                <context-param>

                          <param-name>contextConfigLocation</param-name>

                          <param-value>classpath:/WEB-INF/cxf.xml</param-value>

                </context-param> 

       

                <listener>

                          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                </listener>

        <servlet>

            <servlet-name>CXFServlet</servlet-name>

            <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>

         </servlet>

      <servlet-mapping>

                          <servlet-name>CXFServlet</servlet-name>

                          <url-pattern>/services/*</url-pattern>

                </servlet-mapping>

       

      my cxf.xml looks like this:

      <jaxws:endpoint id='fooService'

                          address='/fooservice'

                          implementor='com.mycom.FooServiceImpl' />

       

      FooService.java (interface):

      @WebService

      public interface ThreeParService {

      @WebMethod

                public String greetings() throws Exception;

      }

       

      FooServiceImpl.java:

      public class FooServiceImpl implements FooService {

      public String greetings() throws Exception {

                          return "hello world!";

                }

      }

        • 1. Re: Jbossws-cxf integration (jbossws-cxf-bin-dist) ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
          amberjboss1999

          Since there was no spring-web.jar installed (STRANGE!!!) by the tool jbossws-cxf-bin-dist, I installed it myself; using spring-web 3.0.0.RELEASE. and now I am getting weird error and I am not sure if it's xml error or some required library missing. My previous CXF web services worked fine on tomcat, so that's why I used the same web.xml and applicationContext.xml header as follows:

          This is very frustrating! Why would Jboss bundle cxf services????? what version of lib and xml should I be using?????

          web.xml:

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

          <web-app version="2.4"

                    xmlns="http://java.sun.com/xml/ns/j2ee"

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

                    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_1286467795540">

          <context-param>

                              <param-name>contextConfigLocation</param-name>

                              <param-value>classpath:jaxws/jaxws-web-context.xml</param-value>

                    </context-param> 

           

          jaxws-web-context.xml:

           

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

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

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

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

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

                    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

                              http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd

                              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

                    <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="fooService"

                            implementor="com.savvis.isd.threepar.service.FooServiceImpl"

                            address="/foo">

                  <jaxws:invoker>

                                        <bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />

                              </jaxws:invoker>

                    </jaxws:endpoint>

            </beans>

           

          stack trace:

          INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [jaxws/jaxws-web-context.xml]

          10:12:44,267 ERROR [ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanDefinitionStoreException: Line 8 in XML document from class path resource [jaxws/jaxws-web-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".

                    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:229) [:3.0.3.RELEASE]

                    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173) [:3.0.3.RELEASE]

                    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148) [:3.0.3.RELEASE]

                    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126) [:3.0.3.RELEASE]

                    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142) [:3.0.3.RELEASE]

                    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126) [:1.2.6]

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

                    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) [:3.0.3.RELEASE]

                    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269) [:3.0.3.RELEASE]

                    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134) [:1.2.6]

                    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) [:1.2.6]

                    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) [:1.2.6]

                    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) [:1.2.6]

                    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3369) [:6.0.0.Final]

                    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3828) [:6.0.0.Final]

                    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:294) [:6.0.0.Final]

                    at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146) [:6.0.0.Final]

                    at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:477) [:6.0.0.Final]

                    at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6.0.0.Final]

                    at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.0.0.Final]

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23-ea]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23-ea]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23-ea]

                    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23-ea]

                    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [:6.0.0.GA]

                    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.GA]

                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]

                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) [:6.0.0.GA]

                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) [:6.0.0.GA]

                    at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) [:2.2.0.GA]

                    at $Proxy41.start(Unknown Source)          at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:53) [:2.2.0.GA]

                    at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:41) [:2.2.0.GA]

                    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:301) [:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.0.GA]

                    at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.GA]

                    at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA]

                    at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]

                    at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]

                    at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]

                    at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]

                    at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]

                    at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]

                    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]

                    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

                    at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]

                    at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]

                    at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]

                    at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]

                    at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]

                    at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]

                    at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]

                    at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]

                    at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

                    at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                    at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                    at java.lang.Thread.run(Thread.java:662) [:1.6.0_23-ea]

          Caused by: org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".

                    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) [xercesImpl.jar:6.0.0.Final]

                    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222) [:3.0.3.RELEASE]

                    ... 93 more

          • 2. Re: Jbossws-cxf integration (jbossws-cxf-bin-dist) ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
            asoldano

            JBoss 6 comes with JBossWS-CXF webservice stack. That's basically the integration of JBossWS with Apache CXF on top of JBoss. You don't need and should not include cxf libs in your deployment and your web.xml descriptor needs to follow the JBossWS way of deploying endpoints (for instance, you do not reference the Apache CXF endpoint servlet, you use the POJO endpoint class as servlet-class). Please have a look at the documentation and examples in the jbossws-cxf src distro (for the spring enabled ones).

            You shouldn't generally need that class from spring-web, that's why that lib is not installed by default. Should you still need, it's fine installing the lib manually. As a matter of fact the -Dspring=true option of the jbossws-cxf installation scripts is a convenient shortcut to manually installing Spring.

            • 3. Re: Jbossws-cxf integration (jbossws-cxf-bin-dist) ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
              amberjboss1999

              Thank you Alessio, so I did follow the user guide to use POJO endpoint and was successful writing a JBossWS web services.

              However, after this, I realized I have to share Jboss6 instance with other apps/services, I shouldn't install/modify 54 jars into jboss common/lib, lib or lib/endorsed directory. should I be following the 2 links below to specify Jboss class loading order? I searched the web, and there doesn't seem to be a working template of jboss-structure.xml for war modules? let alone cxf/spring ones?

               

              http://community.jboss.org/wiki/JBossClassLoadingUseCases

              by providing :

              http://community.jboss.org/wiki/JBoss5CustomMetadataFiles

               

              If you could direct me a working example of what that'll look like, I'd appreciate it very much, thanks!
              Amber