JBoss Community

Cxf Jboss AS 7.1 and Spring problem

created by massai khosa in JBoss Web Services - View the full discussion

Hi all,

I'm in trouble with Spring intégration with cxf and jbossAS 7.1

I'm trying to use the cxf version  which is bundled with jbossAS7.1

As explained in the documentation, I've performed theses steps below:

1)I've created the spring module in jboss with the required jars

2)I've added the spring dependendy in the manifest File

 

When I deploy my webapps, I've a lot of errors below:

 

 

Here are the errors

15:08:18,577 WARN  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-5) Ignored XML validation warning: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 72; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

15:08:18,609 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/ws-jv-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 72; cvc-elt.1: Cannot find the declaration of element 'beans'.

    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) [org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) [org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131) [org.springframework.context-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:530) [org.springframework.context-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:444) [org.springframework.context-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388) [org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) [org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

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

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

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]

    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]

Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 72; cvc-elt.1: Cannot find the declaration of element 'beans'.

    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)

    at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)

    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:390)

    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)

    at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281)

    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1982)

    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:724)

    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)

    at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)

    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)

    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)

    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)

    at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)

    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)

    at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)

    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)

    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) [org.springframework.beans-3.1.4.RELEASE.jar:3.1.4.RELEASE]

    ... 21 more

 

 

Here is my web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 <display-name>wsproto2</display-name>

  <servlet>
    <description>Apache CXF Endpoint</description>
    <display-name>cxf</display-name>
    <servlet-name>cxf</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>cxf</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/ws-jv-context.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

</web-app>

Here is my ws-jv-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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://cxf.apache.org/bindings/soap 
    http://cxf.apache.org/schemas/configuration/soap.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
    
    <jaxws:endpoint xmlns:tns="http://sandbox.casden.fr/"
        id="helloservice" implementor="fr.casden.sandbox.HelloServiceImpl"
        wsdlLocation="wsdl/helloserviceimpl.wsdl" endpointName="tns:HelloServiceImplPort"
        serviceName="tns:HelloServiceImplService" address="/HelloServiceImplPort">
        <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature" />
        </jaxws:features>
    </jaxws:endpoint>
</beans>

My spring module content:

<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
   

    <resources>
  <resource-root path="org.springframework.aop-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.asm-3.1.4.RELEASE.jar"/>
   <resource-root path="org.springframework.aspects-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.beans-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.context-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.context.support-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.core-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.expression-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.instrument-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.oxm-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.web.servlet-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.web-3.1.4.RELEASE.jar"/>
  <resource-root path="org.springframework.transaction-3.1.4.RELEASE.jar"/>
  
        <!-- Insert resources here -->
    </resources>

    <dependencies>
        <module name="javax.enterprise.api"/>
        <module name="javax.api"/>
        <module name="javax.servlet.api"/>
        <module name="org.apache.commons.logging"/>
    </dependencies>
</module>

Any help would be greatly appreciated.
Massai.

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community