Thanks Daniel,

I've found what was wrong. When using CXFServlet, one must import the CXF schemas in his bean definitions. By changing my beans.xml to the following, the problem went away:

   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-addr.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-rm.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

I was actually using CXF 2.2.3.

Daniel Kulp wrote:
What version of CXF?   If you aren't using 2.2.4, I'd suggest trying that.

With 2.2.x, there is no need to do:
<jaxws:features>
<p:policies />
</jaxws:features>

as the engine defaults to on.

Dan


On Mon October 19 2009 9:38:59 am Alexandros Karypidis wrote:
Hi all,

I'm trying to publish a WS-RM service on WebLogic 10.3.1. I am using the
JAX-WS frontend and CXFServlet. When I enable WS-RM, I get a
NullPointerException (see stack trace at end of message) regarding the
WS-Policy. I define the policy in the WSDL and enabling the policies
features in my Spring bean configuration:

WSDL snippet:

<service name='AsyncMessagingService'>
<wsp:PolicyReference URI="#RM"
xmlns:wsp="http://www.w3.org/2006/07/ws-policy"; />
...
<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy";
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-utility-1.0.xsd"> <wswa:UsingAddressing
xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"; />
<wsrmp:RMAssertion
xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy";>
<wsrmp:BaseRetransmissionInterval
Milliseconds="10000" />
<wsrmp:DeliveryAssurance>
<wsp:Policy>
<wsrmp:ExactlyOnce />
<wsrmp:InOrder />
</wsp:Policy>
</wsrmp:DeliveryAssurance>
</wsrmp:RMAssertion>
</wsp:Policy>

Bean configuration for CXFServlet:

<jaxws:endpoint id='AsyncMessaging'
address='/AsyncMessagingService'
implementor='svc.impl.messaging.AsyncMessagingServiceImpl'>
<jaxws:features>
<p:policies />
</jaxws:features>
</jaxws:endpoint>

The error that occurs is logged as follows:

INFO: Creating Service {http://messaging.cmr/}AsyncMessagingService from
WSDL: WEB-INF/wsdl/AsyncMessaging-WrappedHeader-SOAP11-WSRM10.wsdl
19 Οκτ 2009 4:35:48 μμ org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /AsyncMessagingService
19 Οκτ 2009 4:35:48 μμ
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
destroySingletons
INFO: Destroying singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@210faa
: defining beans
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.sp
ring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250Bean
PostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apach
e.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.
apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.Destinati
onFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apach
e.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.wor
kqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org
.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycle
Manager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.trans
ports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverReg
istry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCata
logManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apac
he.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTran
sportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.
cxf.transport.servlet.ServletTransportFactory,AsyncMessaging]; root of
 factory hierarchy
19 Οκτ 2009 4:35:48 μμ org.springframework.web.context.ContextLoader
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'AsyncMessaging': Invocation of init method failed;
nested exception is javax.xml.ws.WebServiceException:
java.lang.NullPointerException
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) ...

Caused by: javax.xml.ws.WebServiceException: java.lang.NullPointerException
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:275)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:209)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:404)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
9) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
l.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374) at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactor
y.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 52 more
Caused by: java.lang.NullPointerException
at
org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:10
0) at
org.apache.cxf.ws.policy.WSPolicyFeature.initializeEndpointPolicy(WSPolicyF
eature.java:139) at
org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:12
2) at
org.apache.cxf.frontend.ServerFactoryBean.applyFeatures(ServerFactoryBean.j
ava:198) at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:150
) at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.j
ava:167) at
 org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:346) at
 org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:259) ... 61
 more



Reply via email to