CXF/Spring as a module deployment error
homer400 Aug 4, 2011 6:57 PMIn AS51 I use CXF (using the Servlet integration, not JBoss-WS CXF). I'm migrating applications to AS7 and in doing so I don't want to re-code everything using JBoss-WS (still want to use the servlet integration and using the version of CXF that my applications were using). To support that I decided to create my own module that contains version 2.2.12 (yeah I know) of CXF and all the libraries that come with its distribution. I took care to remove any dependencies that I could find other modules for. In my modules.xml I have the following:
<module xmlns="urn:jboss:module:1.0" name="org.apache.cxf" slot="2.2">
<resources>
<resource-root path="abdera-core-1.1.jar"/>
<resource-root path="abdera-extensions-json-1.1.jar"/>
<resource-root path="abdera-extensions-main-1.1.jar"/>
<resource-root path="abdera-i18n-1.1.jar"/>
<resource-root path="abdera-parser-1.1.jar"/>
<resource-root path="antlr-2.7.7.jar"/>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="asm-2.2.3.jar"/>
<resource-root path="axiom-api-1.2.7.jar"/>
<resource-root path="axiom-impl-1.2.7.jar"/>
<resource-root path="bcprov-jdk15-1.43.jar"/>
<resource-root path="commons-codec-1.4.jar"/>
<resource-root path="commons-collections-3.2.1.jar"/>
<resource-root path="commons-lang-2.5.jar"/>
<resource-root path="commons-pool-1.5.2.jar"/>
<resource-root path="cxf-2.2.12.jar"/>
<resource-root path="cxf-manifest.jar"/>
<resource-root path="cxf-xjc-boolean-2.2.12.jar"/>
<resource-root path="cxf-xjc-bug671-2.2.12.jar"/>
<resource-root path="cxf-xjc-dv-2.2.12.jar"/>
<resource-root path="cxf-xjc-ts-2.2.12.jar"/>
<resource-root path="FastInfoset-1.2.8.jar"/>
<resource-root path="jaxb-xjc-2.1.13.jar"/>
<resource-root path="jaxen-1.1.1.jar"/>
<resource-root path="jettison-1.2.jar"/>
<resource-root path="jetty-6.1.26.jar"/>
<resource-root path="jetty-util-6.1.26.jar"/>
<resource-root path="jra-1.0-alpha-4.jar"/>
<resource-root path="js-1.7R1.jar"/>
<resource-root path="neethi-2.0.4.jar"/>
<resource-root path="oro-2.0.8.jar"/>
<resource-root path="saaj-api-1.3.jar"/>
<resource-root path="saaj-impl-1.3.2.jar"/>
<resource-root path="serializer-2.7.1.jar"/>
<resource-root path="spring-beans-2.5.6.jar"/>
<resource-root path="spring-context-2.5.6.jar"/>
<resource-root path="spring-context-support-2.5.6.jar"/>
<resource-root path="spring-core-2.5.6.jar"/>
<resource-root path="spring-jms-2.5.6.jar"/>
<resource-root path="spring-tx-2.5.6.jar"/>
<resource-root path="spring-web-2.5.6.jar"/>
<resource-root path="velocity-1.6.4.jar"/>
<resource-root path="wsdl4j-1.6.2.jar"/>
<resource-root path="wss4j-1.5.10.jar"/>
<resource-root path="wstx-asl-3.2.9.jar"/>
<resource-root path="xalan-2.7.1.jar"/>
<resource-root path="xml-resolver-1.2.jar"/>
<resource-root path="xmlbeans-2.4.0.jar"/>
<resource-root path="XmlSchema-1.4.7.jar"/>
<resource-root path="xmlsec-1.4.4.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j" />
<module name="org.slf4j" />
<module name="javax.api" />
<module name="javax.annotation.api" />
<module name="javax.jms.api" />
<module name="javax.jws.api" />
<module name="javax.mail.api" />
<module name="javax.resource.api" />
<module name="javax.servlet.api" />
<module name="javax.xml.bind.api" services="import"/>
<module name="com.sun.xml.bind" services="import"/>
<module name="javax.wsdl4j.api" />
<module name="javax.xml.soap.api" />
<module name="javax.xml.stream.api" />
<module name="javax.xml.ws.api" />
<!--module name="org.springframework.spring" services="import" /-->
</dependencies>
</module>
As you can see I am not using a spring framework module, (yet). I tried that way too and I get the same result anyway.
In my application I have the following descriptor:
WEB-INF/jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="javax.faces.api" slot="main" />
<module name="com.sun.jsf-impl" slot="main" />
</exclusions>
<dependencies>
<module name="org.apache.commons.logging" />
<module name="org.apache.commons.collections" />
<module name="org.apache.log4j" />
<module name="org.dom4j" />
<module name="org.slf4j" />
<module name="com.ibm.notes" />
<module name="org.apache.cxf" slot="2.2" export="true"
services="import">
<imports>
<include path="/**" />
</imports>
</module>
<module name="javax.faces.api" slot="1.2" />
<module name="com.sun.jsf-impl" slot="1.2" />
</dependencies>
</deployment>
</jboss-deployment-structure>
My application has a WEB-INF/cxf-servlet.xml as:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint id="echotest"
implementor="my.path.to.EndpointClass"
address="/echotest">
</jaxws:endpoint>
The web.xml has:
<servlet>
<display-name>CXF Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
This is the error I get:
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143) [spring-core-2.5.6.jar:1.1]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) [spring-beans-2.5.6.jar:1.1]
... 28 more
.. more stack trace...
11:38:04,952 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ax]] (MSC service thread 1-4) StandardWrapper.Throwable: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
Offending resource: /WEB-INF/cxf-servlet.xml
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) [spring-beans-2.5.6.jar:1.1]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) [spring-beans-2.5.6.jar:1.1]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80) [spring-beans-2.5.6.jar:1.1]
... more stack trace...
But this file certainly exists in "cxf-2.2.12.jar" that is in my module.
Has anyone else run into this problem before? Is this related to larger Spring/classloader issues?
Keep in mind my jboss-deployment-structure.xml has:
<module name="org.apache.cxf" slot="2.2" export="true"
services="import">
<imports>
<include path="/**" />
</imports>
</module>
And many other variations were attempted.