Hello,

Recently we had a web service WAR project that used CXF 2.5.2.  It used the
approach of the ContextLoaderListener being configured in the web.xml like
this:

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/cxf-beans.xml</param-value>
    </context-param>
    <listener>

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

This of course requires that one has spring-web-3.0.6.RELEASE.jar
available  (which was part of the Spring 3.0.6.RELEASE set of jars included
in the 2.5.2. distribution).

As of CXF 2.6.0, this spring-web-3.0.6.RELEASE.jar is NO longer included
with the newer Spring 3.0.7.RELEASE set of jars included in the 2.6.0.
distribution).

When one runs the Maven build on the 2.6.0 *samples* specifically
java_first_jaxws, it includes the file called cxf-servlet.xml which IS a
Spring configuration file.

The resulting XML files for this project after running Maven include:

*web.xml*

<web-app version="2.5" 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_2_5.xsd";>
    <display-name>cxf</display-name>

    <servlet>
        <servlet-name>cxf</servlet-name>
        <display-name>cxf</display-name>
        <description>Apache CXF Endpoint</description>

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

</web-app>

*cxf-servlet.xml*

<beans xmlns="http://www.springframework.org/schema/beans";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:jaxws="http://cxf.apache.org/jaxws";
      xmlns:soap="http://cxf.apache.org/bindings/soap";
      xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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:server id="jaxwsService" serviceClass="demo.hw.server.HelloWorld"
address="/hello_world">
      <jaxws:serviceBean>
          <bean class="demo.hw.server.HelloWorldImpl" />
      </jaxws:serviceBean>
  </jaxws:server>
</beans>

It appears that this is *the standard convention* for the name of such a
file (as opposed to the way we were doing it above with a file called
cxf-beans.xml which then required this ContextLoaderListener approach).
The *cxf-servlet.xml *file still however requires the Spring web JAR - in
looking at the dependencies -

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.0.6.RELEASE</version>
        </dependency>

Is there some particular reason why the distribution omits this JAR (though
the pom.xml for the 2.6.0 samples pulls it in allowing the samples to work)
so it is still used....In fact, once I incorporated this into our Ant
build, re-named the cxf-beans.xml to cxf-servlet.xml (not using Maven on
this yet)....the web service deployed on Tomcat w/o errors.

Thanks

Mark

Reply via email to