Has no one got any ideas? Suggestions?

-----Original Message-----
From: Morein, Arnie [mailto:[email protected]] 
Sent: Monday, August 14, 2017 8:45 AM
To: [email protected]
Subject: [EXTERNAL] Spring 4.3.10 and Apache CXF 3.1.12 in WAR project, 
CXFServlet not starting

I am trying to get a few Soap services upgraded by moving them to a new WAR 
project with no UI, just services, and upgrading the various APIs in the 
process.

I am using Spring 4 with XML configuration. When I first deployed my test 
service, everything worked. The CXF Servlet URL (/services/*) registered along 
with my end points and the WSDL was returned.

Then I tried reconfiguring the project to use Spring's new Java Configuration, 
and things went wrong.

After nearly three full days of googling and trying different things, I've 
given up. I am back to XML configuration, but the problem persists: the CXF 
Servlet refuses to activate its root URL, so of course, none the end points are 
available either (despite the fact that they show up as registered in the log).

In my applicationContext.xml file, I have the expected references:

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

Followed by the endpoints:

    <jaxws:endpoint id="service1Endpoint" address="/service1"
        implementorClass="a.b.c.Service1Impl" />

    <jaxws:endpoint id="service2Endpoint" address="/service2"
        implementorClass="a.b.c.Service2Impl" />

I found the cxf.xml file and saw the bean declarations, in particular the one 
for SpringBus:

    <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus" 
destroy-method="shutdown" />

But I was taken aback when I opened the cxf-servlet.xml file from the 
cxf-rt-transports-http-3.1.12.jar file to find a Spring XML configuration file 
- completely devoid of any bean declarations!

I checked in 3.1.10 and found the same thing. A further oddity was this 
namespace:

    xmlns:foo="http://cxf.apache.org/configuration/foo";

why would someone declare a namespace of foo but not one of bar? :) <jk> But it 
does give the impression of something that wasn't finished.

Then I looked in the cxf-rt-frontend-jaxws-3.1.12.jar file and found the 
cxf-extension-jaxws.xml file, which does have something related to a web 
server, a reference to:

org.apache.cxf.jaxws.context.WebServiceContextResourceResolver

So now I have this:

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

But still the servlet referenced in the web.xml file never seems to "start up":

Perhaps it might be due to the sparse nature of my web.xml:

    <servlet>
        <display-name>CXF Servlet</display-name>
        <servlet-name>CXFServlet</servlet-name>
        
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

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

Any suggestion would be much appreciated.

Reply via email to