You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mark Streit <mc...@gmail.com> on 2012/04/27 19:06:11 UTC

clarifying questions re: CXF 2.6.0 recent changes

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

Re: clarifying questions re: CXF 2.6.0 recent changes

Posted by Gary Gregory <GG...@rocketsoftware.com>.
Could CXF simple deliver an all in one Spring jar?  I'd do the same for Jetty. Seems simple and the extra bytes don't matter to my project. I imagine others would differ. 

Gary

On Apr 27, 2012, at 13:06, "Mark Streit" <mc...@gmail.com> wrote:

> 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

Re: clarifying questions re: CXF 2.6.0 recent changes

Posted by Daniel Kulp <dk...@apache.org>.
I went ahead and added the spring-web jar back into the lib dir for 2.6.1.   
In general, Maven users don't need the stuff in the lib dir at all.   The 
stuff in lib really should be "helpful" for the non-maven users so adding 
the jar back in there is simple and should help.

Dan


On Friday, April 27, 2012 01:06:11 PM Mark Streit wrote:
> 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</lis
> tener-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
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com