Discussion:
[jboss-user] [JBoss Web Services] - Cxf Jboss AS 7.1 and Spring problem
massai khosa
2013-01-24 16:10:11 UTC
Permalink
massai khosa [https://community.jboss.org/people/mbsakho] created the discussion

"Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/794109#794109

--------------------------------------------------------------
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 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
[https://community.jboss.org/message/794109#794109]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Alessio Soldano
2013-01-28 11:53:31 UTC
Permalink
Alessio Soldano [https://community.jboss.org/people/asoldano] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/794583#794583

--------------------------------------------------------------
Please have a look at the documentation on JBossWS - Apache CXF integration on JBoss AS 7 : https://docs.jboss.org/author/display/AS71/Webservices+reference+guide https://docs.jboss.org/author/display/AS71/Webservices+reference+guide
In particularm you're not expected to have that web.xml referring cxf servlet.

There're some examples you can have a look at in the jbossws source distributions at http://www.jboss.org/jbossws/downloads http://www.jboss.org/jbossws/downloads
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/794583#794583]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
massai khosa
2013-01-29 09:53:58 UTC
Permalink
massai khosa [https://community.jboss.org/people/mbsakho] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/794834#794834

--------------------------------------------------------------
Alessio,
I've read the the Apache CXF documentation. I'm stil having a doubt about spring integration that is explained in the link below:
https://docs.jboss.org/author/display/AS71/Apache+CXF+integration https://docs.jboss.org/author/display/AS71/Apache+CXF+integration

As I undestand, I don't need to declare the cxf servlet or the spring context listener as I did.
But I have to declare my spring endpoints and beans in the jbossws-cxf.xml which must be located in the WEB-INF directory.
Could you confirm me?

I haven't found any example about spring integration in the source distribution and I'll be happy to have one :-)

Thank in advance.
Massai
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/794834#794834]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
massai khosa
2013-02-05 10:37:05 UTC
Permalink
massai khosa [https://community.jboss.org/people/mbsakho] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/796101#796101

--------------------------------------------------------------
Alessio,
I've finally managed to make my web services work with cxf and spring.
Massai.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796101#796101]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Carlo Bertoldi
2013-02-23 15:37:47 UTC
Permalink
Carlo Bertoldi [https://community.jboss.org/people/cbertoldi] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/799203#799203

--------------------------------------------------------------
Massai, would you be so kind to share the solution to your problem?
Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799203#799203]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
massai khosa
2013-02-25 12:39:06 UTC
Permalink
massai khosa [https://community.jboss.org/people/mbsakho] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/799359#799359

--------------------------------------------------------------
Hello Carlo,
I don't know the exact problem you're having.
But if it's just using cxf web services with spring here is the step to follow.
1)You have to create the spring module
2)You must indicate to jboss that you're using the spring module. You can do it either in the META-INF file or by using the jboss-deployment-structure.xml file.
3)You can then define you beans, endpoints in the jbossws-cxf.xml file

You don't need to add anything else. I must work
I've attached these to files.
If you need another sample (wsdl file for example) or have any question, let me know.
Massai
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799359#799359]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Carlo Bertoldi
2013-02-26 08:53:40 UTC
Permalink
Carlo Bertoldi [https://community.jboss.org/people/cbertoldi] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/799545#799545

--------------------------------------------------------------
Thank you for replying very quickly :)
Post by massai khosa
Hello Carlo,
I don't know the exact problem you're having.
But if it's just using cxf web services with spring here is the step to follow.
1)You have to create the spring module
I have a doubt: should I install Spring dependencies using the ant build included in *jbossws-cxf* distribution, or can I just copy the Spring modules of my application?
I'm afraid that in the first case I'd have to maintain two different Spring version, one for the AS and one for my application. I don't want to think what could happen with multiple applications installed with different versions of Spring. But maybe my reasoning is simply wrong.

Still, if the first hypotesis stands, why should I keep on using the JBossWS implementation, instead of disabling it, and provide my own preferred implementation in the application?
What are the advantages of using JBossWS?
Thanks

PS forgive my English, non native speaker here ;)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799545#799545]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Alessio Soldano
2013-02-26 09:16:27 UTC
Permalink
Alessio Soldano [https://community.jboss.org/people/asoldano] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/799548#799548

--------------------------------------------------------------
Post by Carlo Bertoldi
I have a doubt: should I install Spring dependencies using the ant build included in *jbossws-cxf* distribution, or can I just copy the Spring modules of my application?
You can use the spring version you want as long as the org.springframework.spring module is properly created (either manually or through the jbossws build).
Post by Carlo Bertoldi
Still, if the first hypotesis stands, why should I keep on using the JBossWS implementation, instead of disabling it, and provide my own preferred implementation in the application?
What are the advantages of using JBossWS?
It's basically a matter of deciding if you want a web application that has ws functionalities in it thanks to the jaxws impl embedded in it, or if you want a full javaee application. The latter, using the jbossws / cxf libs on the server, offer proper integration of with the AS internals, support for jcp specs not covered by cxf (e.g. JSR 109), etc.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799548#799548]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
massai khosa
2013-02-27 16:49:14 UTC
Permalink
massai khosa [https://community.jboss.org/people/mbsakho] created the discussion

"Re: Cxf Jboss AS 7.1 and Spring problem"

To view the discussion, visit: https://community.jboss.org/message/799932#799932

--------------------------------------------------------------
Carlo,
I completly agree with Alessio for two reasons:
1. It is not as simple as you can imagine to disable Jboss WS and use you own prefered implementation.
2. Imgagine multiple of your applications need to use their own implementation. What would you do so? provide an implementation for each?
I've tried it first and it was not a real success.
Meissa
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799932#799932]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Loading...