Greetings,

Im currently working on upgrading a Spring MVC web project to Java 8 and Spring 
4.2 on a Tomcat 7 server, where we also use CXF 2.2.3 with Aegis data binding 
for our SOAP messages. As far as I’ve understood from the different forum 
posts, this system upgrade requires a CXF upgrade to a newer version (3.1.x) 
also. 

Unfortunately after completing the process and switching out the dependencies 
I’m currently getting a NullPointerException at startup, more precisely at the 
JaxWsProxyFactoryBean.getConfiguredName (see stack trace below).

Caused by: java.lang.NullPointerException
        at 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.getConfiguredName(JaxWsProxyFactoryBean.java:77)
        at 
org.apache.cxf.frontend.ClientProxyFactoryBean.configureObject(ClientProxyFactoryBean.java:103)
        at 
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:133)
        at 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        ... 24 more

Used the following maven dependencies:

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <version>${cxfVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-bindings-soap</artifactId>
            <version>${cxfVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxfVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxfVersion}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-databinding-aegis</artifactId>
            <version>${cxfVersion}</version>
        </dependency>

Where ${cxfVersion} is 3.1.6.

Finally the spring configuration 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:jee="http://www.springframework.org/schema/jee";
        xmlns:jaxws="http://cxf.apache.org/jaxws";
        xsi:schemaLocation="
                        http://www.springframework.org/schema/beans 
                        
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
                        http://cxf.apache.org/jaxws 
                        http://cxf.apache.org/schemas/jaxws.xsd
                        http://code.lds.org/schema/spring/ws 
                        http://code.lds.org/schema/spring/ws/stack-ws-2.2.xsd";>

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

        <!-- Configure CXF to use Aegis data binding instead of JAXB -->
    <bean id="aegisBean"
          class="org.apache.cxf.aegis.databinding.AegisDatabinding"
          scope="prototype"/>
    <bean id="jaxwsAndAegisServiceFactory"
          class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
          scope="prototype"> 
        <property name="dataBinding" ref="aegisBean"/>
        <property name="serviceConfigurations">
          <list>
            <bean 
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
            <bean 
class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"/>
            <bean 
class="org.apache.cxf.wsdl.service.factory.DefaultServiceConfiguration"/> 
          </list>
        </property>
    </bean>

    <!-- Factory to create the dynamic proxy -->
    <bean id=“webServiceFactory" 
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value=“<service_class>"/>
        <property name="address" value=“<address>"/>
        <property name="username" value=“<username>" />
        <property name="password" value=“<password>" />
        <property name="serviceFactory" ref="jaxwsAndAegisServiceFactory"/>
    </bean>
    
    <!-- Web service dynamic proxy -->
    <bean id=“myWebService"
          class=“<class_location>"
          factory-bean="webServiceFactory"
          factory-method="create”/>
</beans>

I’m convinced that the problem comes from the xml configuration, but I didn’t 
find any examples for the new version (3.x).

Any help would be much appreciated.

Best regards,
Albert

Reply via email to