I've got it fixed, added few guards to a couple of policy interceptors thanks, Sergey
On Fri, Apr 23, 2010 at 2:29 PM, Sergey Beryozkin <[email protected]>wrote: > Hi > > Policy engine 'affects' all the endpoints so I guess when a request for the > JAXRS service arrives a PolicyInInterceptor gets some null object which > would otherwise be initialized. What CXF version you're using ? I'll check > the '132' line and see if I can fix it > > cheers, Sergey > > > On Fri, Apr 23, 2010 at 12:28 PM, Daniel Putra <[email protected]> wrote: > >> Hi >> >> I have multiple third party web services (I connect to a third party web >> service) and a server RESTfull web service (web service clients connect to >> me) in a Spring application. >> >> One third party web service is only working if a policy engine is >> specified like >> >> <bean id="org.apache.cxf.ws.policy.PolicyEngine" >> class="org.apache.cxf.ws.policy.PolicyEngineImpl"> >> <property name="bus" ref="cxf"/> >> <property name="enabled" value="true"/> >> </bean> >> as it otherwise throws the following exception: >> >> java.lang.NullPointerException >> at >> org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:100) >> at >> org.apache.cxf.ws.policy.WSPolicyFeature.initializeEndpointPolicy(WSPolicyFeature.java:139) >> at >> org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:112) >> at >> org.apache.cxf.frontend.ClientFactoryBean.applyFeatures(ClientFactoryBean.java:71) >> at >> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:60) >> at >> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102) >> at >> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115) >> >> But as soon as I add the PolicyEngine bean into the xml my RESTful web >> service does not work any longer. It throws the following null pointer >> exception: >> >> 2010-04-23 13:08:40,758 WARN [org.apache.cxf.phase.PhaseInterceptorChain] >> - Interceptor for >> {http://party.misc.profidaweb/}PartyServiceRest<http://party.misc.profidaweb/%7DPartyServiceRest>has >> thrown exception, unwinding now >> java.lang.NullPointerException >> at >> org.apache.cxf.ws.policy.PolicyInInterceptor.handle(PolicyInInterceptor.java:132) >> at >> org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:45) >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) >> at >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110) >> at >> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98) >> at >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423) >> at >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139) >> at >> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) >> >> I attach my configuration file for the RESTfull web service. The client >> web services are defined in java like: >> >> Map<String, Object> outProps = new HashMap<String, Object>(); >> outProps.put(WSHandlerConstants.ACTION, >> WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN); >> outProps.put(WSHandlerConstants.USER, >> userPerson.fseLoginType() + "\\" + userPerson.getFSELoginName()); >> outProps.put(WSHandlerConstants.PASSWORD_TYPE, >> WSConstants.PW_TEXT); >> outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, >> PasswordCallbackHandler.class.getName()); >> WSS4JOutInterceptor wss4jOut = new >> WSS4JOutInterceptor(outProps); >> >> JaxWsProxyFactoryBean wsFactory = new JaxWsProxyFactoryBean(); >> wsFactory.getOutInterceptors().add(wss4jOut); >> wsFactory.setServiceClass(FseWebService_DEF.class); >> wsFactory.setAddress(url); >> wsFactory.getFeatures().add(new WSPolicyFeature()); >> >> FseWebService_DEF fseWebService = >> (FseWebService_DEF)wsFactory.create(); >> >> Please help, how can I either change the client or the RESTfull web >> service declaration to avoid the null pointer exception and have both >> working next to each other? >> >> Best regards >> Daniel Putra >> > >
