2 Replies Latest reply on Jul 29, 2013 5:37 AM by tgirard

    JBossws doesn't read my jbossws-cxf file ?

    tgirard Newbie

      Hi everyone.

       

      I'm trying to deploy a web service using jbossws (+Spring). Here's what happens when I deploy (I had to replace some info with *** because of my company's absurdly strict policy about confidentiality, sorry. But if something's missing I can probably give more detail) :

      10:58:06,470 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "***-ws-web-2.1-SNAPSHOT.war"

       

      10:58:11,845 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.***-ws-web-2.1-SNAPSHOT.war" is using a private module ("org.apache.cxf:main") which may be changed or removed in future versions without notice.

      10:58:11,845 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.***-ws-web-2.1-SNAPSHOT.war" is using a private module ("org.apache.cxf:main") which may be changed or removed in future versions without notice.

      10:58:11,845 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.***-ws-web-2.1-SNAPSHOT.war" is using a private module ("org.jboss.ws.cxf.jbossws-cxf-client:main") which may be changed or removed in future versions without notice.

      10:58:11,861 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.***-ws-web-2.1-SNAPSHOT.war" is using a private module ("org.jboss.ws.cxf.jbossws-cxf-client:main") which may be changed or removed in future versions without notice.

       

      10:58:11,908 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/***-ws-web-2.1-SNAPSHOT]] (MSC service thread 1-4) Initializing Spring root WebApplicationContext

      10:58:11,908 INFO  [org.springframework.web.context.ContextLoader] (MSC service thread 1-4) Root WebApplicationContext: initialization started

      10:58:11,908 INFO  [org.springframework.web.context.support.XmlWebApplicationContext] (MSC service thread 1-4) Refreshing Root WebApplicationContext: startup date [Tue Jul 09 10:58:11 CEST 2013]; root of context hierarchy

      10:58:11,923 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-4) Loading XML bean definitions from ServletContext resource [/WEB-INF/application-context.xml]

      10:58:11,939 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-4) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ca1272: defining beans []; root of factory hierarchy

      10:58:11,939 INFO  [org.springframework.web.context.ContextLoader] (MSC service thread 1-4) Root WebApplicationContext: initialization completed in 31 ms

       

      10:58:11,954 INFO  [org.jboss.web] (MSC service thread 1-4) JBAS018210: Registering web context: /***-ws-web-2.1-SNAPSHOT

      10:58:12,392 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "***-ws-web-2.1-SNAPSHOT.war"

       

      1) As you can see, JBoss reads my spring application-context.xml file (declared from web.xml, empty for now). But it never reads my jbossws-cxf file and thus doesn't deploy the web service. The file is in WEB-INF/ I think that's where it should be, so I don't know why it isn't read. For reference here are the contents of the file:

      <?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:context="http://www.springframework.org/schema/context"   

          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://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

              http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

       

          <context:spring-configured />

       

          <!-- Create service beans (should be moved to serviceImpl later) -->

          <context:annotation-config />

          <context:component-scan base-package="***.ws.service" />

       

          <!-- Web services endpoints -->

          <jaxws:endpoint id="***ServiceEndpoint"

              implementor="#***ServiceV1"

              implementorClass="***.ws.service.impl.v1.***Impl"

              serviceName="v1:***ServiceV1" endpointName="v1:***ServiceV1"

              wsdlLocation="wsdl/***ServiceV1.wsdl" address="/***ServiceV1">

          </jaxws:endpoint>

       

      </beans>

       

      2) Are the 4 warnings in the log about private modules ok ? Should I do something about that ?

       

      3) There's a thing I don't understand about the behavior of integrating with jbossws vs. spring. When not using jboss-ws, I would have my endpoint declared in the spring context, and my service beans autowired into the endpoint bean. Will that work the same with jboss-ws ? Is my config above correct: should I declare the context (especially component-scan) here in the jbossws-cxf file, or in my application-context ? Do those 2 files actually describe the same context ?

       

      All this is on JBoss 7.1.1 final, cxf 2.4.6 (the one bundled with jboss) and Spring 3.0.5 (installed manually as module).

       

      Hope you can help, thanks in advance.

       

      Thomas

       

       

      EDIT: here's also my web.xml, I guess that might be useful

       

      <web-app id="***_ws_web">  

          <context-param>

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

              <param-value>WEB-INF/application-context.xml</param-value>

          </context-param>

         

          <filter>

              <filter-name>requestContextFilterChain</filter-name>

              <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>

          </filter>

       

          <filter-mapping>

              <filter-name>requestContextFilterChain</filter-name>

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

          </filter-mapping>

       

          <listener>

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

          </listener>

      </web-app>

        • 1. Re: JBossws doesn't read my jbossws-cxf file ?
          Alessio Soldano Master

          Hi,

          please have a look at [1] and in particular at [2]. The jbossws-cxf.xml is used during deployment phase to create an additional spring application context for the deployment. You might need to have a cxf.xml too in your deployment (in WEB-INF/classes dir) for those additional spring related configurations.

          Regarding the web.xml descriptor, you really need to modify that to list the ws endpoint classes and remove the spring stuff (listener, etc), have a look at some of the examples in the cxf-spring-testsuite module of jbossws-cxf sources. Btw, starting from JBossWS 4.2.0.Final you won't need anymore to duplicate the endpoint beans info in the jbossws-cxf.xml [3].

          You can ignore those specific warnings; those modules have been made public in more recent AS releases, so they will go away in future.

           

          [1] https://docs.jboss.org/author/display/JBWS/Apache+CXF+integration

          [2] https://docs.jboss.org/author/display/JBWS/Apache+CXF+integration#ApacheCXFintegration-Serverside

          [3] https://issues.jboss.org/browse/JBWS-3396

          1 of 1 people found this helpful
          • 2. Re: JBossws doesn't read my jbossws-cxf file ?
            tgirard Newbie

            Hi Alessio, thank you for your reply.

             

            Following your advice I did remove the spring stuff from my web.xml and declared the servlets instead. Now the endpoints are created properly, and I can do some basic tests. Thanks.

             

            Still my problem is not completely solved, as I am still unable to have both my endpoint and Spring injections work.

            Now that the endpoints work, the jbossws-cxf.xml file is read. But I get a new problem related to the VFS:

             

            11:27:31,235 INFO  [org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader] (MSC service thread 1-1) Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]

            11:27:31,235 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-1) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@89f07c: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor]; root of factory hierarchy

             

            11:27:31,266 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Loading XML bean definitions from resource loaded through InputStream

            11:27:31,297 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-1) Loading XML bean definitions from URL [vfs:/C:/jboss711/bin/content/eHotela-ws-web-2.2-SNAPSHOT.war/WEB-INF/lib/eHotela-ws-serviceImpl-2.2-SNAPSHOT.jar/applicationContext-test-shared.xml]

            11:27:31,313 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-1) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning

             

            So the jbossws-cxf.xml file is read and the cxf.xml file is generated properly. In this file I do this:

            <import resource="classpath*:applicationContext-test-shared.xml" />

             

            Which triggers this error:

             

            11:27:31,329 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."eHotela-ws-web-2.2-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."eHotela-ws-web-2.2-SNAPSHOT.war".INSTALL: Failed to process phase INSTALL of deployment "eHotela-ws-web-2.2-SNAPSHOT.war"

            [...]

            Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:applicationContext-test-shared.xml]

             

            Offending resource: resource loaded through InputStream; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [vfs:/C:/jboss711/bin/content/eHotela-ws-web-2.2-SNAPSHOT.war/WEB-INF/lib/eHotela-ws-serviceImpl-2.2-SNAPSHOT.jar/applicationContext-test-shared.xml]; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.core.io.support.VfsPatternUtils

             

            [...]

             

            Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.core.io.support.VfsPatternUtils

                at org.springframework.core.io.support.PathMatchingResourcePatternResolver$VfsResourceMatchingDelegate.findMatchingResources(PathMatchingResourcePatternResolver.java:651)

            [...]

             

            I checked in my Spring jars in the Jboss module (spring-core-3.0.5) and the VfsPatternUtils class is there. Any idea what the problem could be ?