WARNING [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for ... has thrown exception, unwinding now: java.lang.NullPointerException
shawnwevans Dec 6, 2010 4:50 PMI have been trying to get my CXF webservices to work with the JBoss CXF stack (jboss-6.0.0.20100721-M4). They work just fine utilizing the apache cxf libraries, but I keep getting -> WARNING [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for ... has thrown exception, unwinding now: java.lang.NullPointerException. Your help would be appreciated.
Thank you,
Shawn
**********************************************
Java code used to run with the apache cxf libraries in stand-alone (this works):
private void createDemoService(final AegisDatabinding aDB)
{
JacobDemoServiceImpl jacobDemoService = new JacobDemoServiceImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
addInterceptors(svrFactory);
svrFactory.setServiceClass(JacobDemoService.class);
svrFactory.setAddress(Configuration.getProperty("service.address") + "JacobDemoService");
svrFactory.setServiceBean(jacobDemoService);
svrFactory.getServiceFactory().setDataBinding(aDB);
svrFactory.create();
}
private void addInterceptors(final JaxWsServerFactoryBean svrFactory)
{
//svrFactory.getInInterceptors().add(new LoggingInInterceptor());
//svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);
// Password type : plain text
inProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
// Callback used to retrieve password for given user.
inProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ServerPasswordHandler.class.getName());
WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
svrFactory.getInInterceptors().add(wssIn);
**********************************************
jbossws-cxf.xml (this doesn't work):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:simple="http://cxf.apache.org/simple"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/simple
http://cxf.apache.org/schemas/simple.xsd">
<!-- The service bean -->
<bean id="JacobDemoServiceImpl" class="com.northgrum.jacob.services.demo.JacobDemoServiceImpl" />
<!-- Aegis data binding -->
<bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding"
scope="prototype">
<property name="configuration">
<bean class="org.apache.cxf.aegis.type.TypeCreationOptions">
<property name="defaultMinOccurs" value="1" />
<property name="defaultNillable" value="false" />
</bean>
</property>
</bean>
<bean id="aegis-service-factory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
scope="prototype">
<property name="dataBinding" ref="aegisBean" />
</bean>
<!-- WSS4JInInterceptor beans for authentication -->
<bean id="myPasswordCallback"
class="com.northgrum.jacob.services.security.ServerPasswordHandler" />
<bean id="JACOB_WS_User_Auth_Int" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken" />
<entry key="passwordType" value="PasswordText" />
<entry key="passwordCallbackRef">
<ref bean="myPasswordCallback" />
</entry>
</map>
</constructor-arg>
</bean>
<jaxws:endpoint id="JacobDemoService"
implementorClass="com.northgrum.jacob.services.demo.JacobDemoServiceImpl"
implementor="#JacobDemoServiceImpl" address="/JacobDemoService">
<jaxws:serviceFactory>
<ref bean="aegis-service-factory" />
</jaxws:serviceFactory>
<jaxws:invoker>
<bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />
</jaxws:invoker>
</jaxws:endpoint>
<!-- CXF Bus -->
<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
<bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
<cxf:bus>
<cxf:inInterceptors>
<ref bean="logInbound" />
<!-- <ref bean="JACOB_WS_User_Auth_Int" /> -->
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="logOutbound" />
</cxf:outInterceptors>
<cxf:inFaultInterceptors>
<ref bean="logOutbound" />
</cxf:inFaultInterceptors>
</cxf:bus>
</beans>
**********************************************
Log file excerpts from JBoss Server:
INFO [ReflectionServiceFactoryBean] Creating Service {http://demo.services.jacob.northgrum.com/}JacobDemoService from class com.northgrum.jacob.common.demo.JacobDemoService
INFO [ServerImpl] Setting the server's publish address to be /JacobDemoService
.
.
.
----------------------------
ID: 1
Address: /jacob/services/JacobDemoService
Encoding: UTF-8
Content-Type: text/xml; charset=UTF-8
Headers: {cache-control=[no-cache], content-type=[text/xml; charset=UTF-8], connection=[keep-alive], host=[localhost:8080], Content-Length=[917], SOAPAction=[""
], user-agent=[Apache CXF 2.2.9], Content-Type=[text/xml; charset=UTF-8], Accept=[*/*], pragma=[no-cache]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oa
sis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecu
rity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1"><wsse:Username>test
_1</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><sessionid>cdee38d0-7
97c-41d5-8f79-2e238bc7883f</sessionid><password>blah_blah</password></wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><
ns1:echo xmlns:ns1="http://demo.common.jacob.northgrum.com/"><ns1:text>World</ns1:text></ns1:echo></soap:Body></soap:Envelope>
--------------------------------------
.
.
.
WARNING [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for {http://demo.services.jacob.northgrum.com/}JacobDemoService#{http://demo.commo
n.jacob.northgrum.com/}echo has thrown exception, unwinding now: java.lang.NullPointerException