7 Replies Latest reply on Mar 6, 2011 1:18 PM by lgosselin

    JBoss 6 - Spring 3.0.5 & CXF Error

    mrbaljit

      Hi,

       

      I am trying to deploy web-app which contains spring 3.0.5 jars files. During the server startup, I am getting the following error:

       

      Caused by: org.springframework.beans.FatalBeanException: Class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
      at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:126) [:2.5.6]
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1330) [:2.5.6]
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) [:2.5.6]
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) [:2.5.6]
      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) [:2.5.6]
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [:2.5.6]
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [:2.5.6]
      ... 114 more

      org.springframework.beans.FatalBeanException: Class [org.apache.cxf.jaxws.spring.NamespaceHandler] for namespace [http://cxf.apache.org/jaxws] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface

       

      I have not included any cxf files in WEB-INF/lib directory. Any idea on the error above?

       

      Regards,

       

      Baljit

        • 1. Re: JBoss 6 - Spring 3.0.5 & CXF Error
          asoldano

          Is you web-app a webservice deployment at all? Can you share more details on your app and its packaging and post the full stacktrace?

          • 2. JBoss 6 - Spring 3.0.5 & CXF Error
            mrbaljit

            Hi Alessio,

             

            Sorry for the late reply.

             

            After talking to my team members, we would like to have control of the jar files which we add to WEB-INF/lib directory.

            Currently we have no plans to upgrade cxf to 2.3.1 version (comes by default with JBoss 6) in our web-app.

             

            Could please provide me information of using class loader configuration for the war file in JBoss 6? I have tried few methods posted on this site but failed to get it working.

            Any other ideas are welcome.

             

            Regards,

             

            Baljit

            • 3. JBoss 6 - Spring 3.0.5 & CXF Error
              asoldano

              Trying to run an Apache CXF version different from the one included in AS 6 is going to be quite complex exercise, definitely not something we can support.

              If you want to play with the classloading on AS 6, consider taking a look at http://java.dzone.com/articles/jboss-microcontainer-classloading

              Generally speaking, if you're looking for ideas on running your app as is with no changes, you might want to install the jbossws-native stack (3.4.1 version) on JBoss AS 6, to avoid mixing CXF version. Please note however that JBossWS-CXF is going to be the default WS stack for AS 7 too.

              • 4. JBoss 6 - Spring 3.0.5 & CXF Error
                mrbaljit

                Alessio,

                 

                Thanks for the posting. I am following the instructions at http://community.jboss.org/wiki/useJBossWebClassLoaderinJBoss5 for classloading.

                 

                Now, I am getting Unresolved conflict on resource environment reference named: cxf

                 

                Stack trace :

                 

                19:21:48,998 ERROR [AbstractKernelController] Error installing to PostClassLoader: name=vfs:///C:/jboss-6.0.0.Final/server/all/deploy/sample-webapp-dev-999.war state=ClassLoader mode=Manual requiredState=PostClassLoader: org.jboss.deployers.spi.DeploymentException: Deployment error processing fragment for JAR: cxf-rt-transports-http-2.3.1.jar

                          at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.0.GA]

                          at org.jboss.web.deployers.MergedJBossWebMetaDataDeployer.deploy(MergedJBossWebMetaDataDeployer.java:394) [:6.0.0.Final]

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

                Caused by: java.lang.IllegalStateException: Unresolved conflict on resource environment reference named: cxf

                          at org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData.augment(ResourceEnvironmentReferencesMetaData.java:78) [:2.0.0.Alpha24]

                          at org.jboss.metadata.javaee.spec.RemoteEnvironmentRefsGroupMetaData.augment(RemoteEnvironmentRefsGroupMetaData.java:580) [:2.0.0.Alpha24]

                          at org.jboss.metadata.javaee.spec.EnvironmentRefsGroupMetaData.augment(EnvironmentRefsGroupMetaData.java:191) [:2.0.0.Alpha24]

                          at org.jboss.metadata.web.spec.WebCommonMetaData.augment(WebCommonMetaData.java:941) [:2.0.0.CR1]

                          at org.jboss.web.deployers.MergedJBossWebMetaDataDeployer.deploy(MergedJBossWebMetaDataDeployer.java:390) [:6.0.0.Final]

                          ... 44 more

                 

                Thanks

                • 5. JBoss 6 - Spring 3.0.5 & CXF Error
                  lgosselin

                  Have you resolved this issue? I encounter the same problem while I was trying to use CXF from a webapp.

                   

                  As JBoss 6 does not seem to work without JBossWS ("ant undeploy-jboss600" from jbossws-cxf-3.4.1.GA binary distribution prevent JBoss from starting up with a java.lang.NoClassDefFoundError: org/jboss/wsf/spi/invocation/integration/ServiceEndpointContainer), I installed JBossWS-native. But then the stack you're mentionning arise.

                   

                  Any clue ?

                  • 6. JBoss 6 - Spring 3.0.5 & CXF Error
                    mrbaljit

                    Laurent,

                     

                    Sorry for the late reply. I haven't solved this issue yet.

                     

                    Any update on your side?

                     

                    Baljit

                    • 7. JBoss 6 - Spring 3.0.5 & CXF Error
                      lgosselin

                      Sorry I was away last week.

                       

                      I was stuck for a while because I could not start my server and deploy a few webservices. I finally found a way around the various confusing stacks and errors I had.  But I'm still unsure which version of CXF handles my WS calls...  (2.3.1 from JBoss-WS-CXF or 2.3.2 from my webapp)

                       

                      So my goal was to deploy an EAR file which contains one or more WARs. The application depends on Spring 3.0.5, CXF 2.3.2 and I had in mind to add Spring Security 3.0.5 to the mix (while waiting for 3.5.0). I wanted to have the control over the version of Spring & CXF independently from what JBoss provides. I did not succeed completely on that point because I need to provide Spring in server/<my_server>/lib when I use a vanilla JBoss 6 final. JBoss-WS-CXF binary distribution can help you to install them but I chose to copy my JARs manually for now.

                       

                      To have my experiment working I've had to:

                      - copy Spring dependencies into server/<my_server>/lib. (I have spring-aop, spring-asm, spring-beans, spring-context, spring-core, spring-expression, spring-jms, spring-web and aopalliance-1.0. It is probably not the minimal set of libs to have it working but I did not try to shrink that list yet)

                      - isolate the classloader of my EAR and make it the parent of my WARs classloaders.

                      - prevent JBoss from scanning jaxb-xjc-2.1.13.jar (If you're using JAXB bindings, it will crash because it cannot find a class named JConditional and possibly others. I suppose it is due to the package name which contains "1.0". The class location is jar/1.0/com/ instead of jar/1/0/com. I still have to figure out how it is possible to include dots in a package name...)

                       

                      Here are the configuration files I'm using:

                      * sample-ear.ear/META-INF/jboss-classloading.xml

                      [code]

                      <classloading xmlns="urn:jboss:classloading:1.0"

                          domain="sample-ear.ear"

                          export-all="NON_EMPTY"

                          import-all="true"

                          parent-first="false">

                      </classloading>

                      [code]

                       

                      * sample-ear.ear/simple1.war/WEB-INF/jboss-classloading.xml

                      [code]

                      <classloading xmlns="urn:jboss:classloading:1.0"

                          domain="simple1.war"

                          parent-domain="sample-ear.ear"

                          export-all="NON_EMPTY"

                          import-all="true">

                      </classloading>

                      [code]

                       

                      * sample-ear.ear/simple1.war/WEB-INF/jboss-scanning.xml

                      Ask ScanningMetaDataDeployer to scan the classes provided with my webapp and exclude every classes included in jaxb-xjc-2.1.13.jar.

                      [code]

                      <scanning xmlns="urn:jboss:scanning:1.0">

                        <path name="WEB-INF/classes">

                        </path>

                        <path name="WEB-INF/lib/jaxb-xjc-2.1.13.jar">

                           <exclude name="" recurse="true"/> <!-- thx to RecursivePackageClassFilter -->

                        </path>

                      </scanning>

                      [code]

                       

                      That's it. To make this work, I have to credit Alessio Soldano and Ales Justin. I read a lot of their posts during my research and it turns out that they were the more inspiring ones.

                       

                      Laurent