[ 
https://issues.apache.org/jira/browse/CXF-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573686#action_12573686
 ] 

Sergey Beryozkin commented on CXF-1318:
---------------------------------------

Can you please have a look at RMPolicyTest system test ?
It shows how you can extrernally attach policies to a given endpoint, without 
using jaxws:endpoints.

See rm.xml in the same package. I think you don't even need to specify all the 
wsa and rm interceptors when using policies.

If you prefere to keep policies in the wsdl, then perhaps the way rm.xml sets 
up a policy engine will fix things for you...(just remove the external 
attachment bean definitions... )

Can you give it a try please ?

Also, this issue might've been fixed in 2.1 trunk, not sure




> NPE in PolicyEngineImpl / CXF bus is not initialized
> ----------------------------------------------------
>
>                 Key: CXF-1318
>                 URL: https://issues.apache.org/jira/browse/CXF-1318
>             Project: CXF
>          Issue Type: Sub-task
>          Components: WS-* Components
>    Affects Versions: 2.0.3
>            Reporter: Thomas Diesler
>
> Following http://cwiki.apache.org/CXF20DOC/wspconfiguration.html, I set 
>   <p:engine enabled="true" ignoreUnknownAssertions="true"/>
> to enable the policy engine.
> I get 
> Caused by: java.lang.NullPointerException
>         at 
> org.apache.cxf.ws.policy.PolicyEngineImpl.supportsAlternative(PolicyEngineImpl.java:514)
>         at 
> org.apache.cxf.ws.policy.selector.MinimalAlternativeSelector.selectAlternative(MinimalAlternativeSelector.java:43)
>         at 
> org.apache.cxf.ws.policy.EndpointPolicyImpl.chooseAlternative(EndpointPolicyImpl.java:93)
>         at 
> org.apache.cxf.ws.policy.EndpointPolicyImpl.initialise(EndpointPolicyImpl.java:81)
>         at 
> org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:498)
>         at 
> org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:220)
>         at 
> org.apache.cxf.transport.http.policy.PolicyUtils.getClient(PolicyUtils.java:146)
>         at 
> org.apache.cxf.transport.http.HTTPConduit.initializeConfig(HTTPConduit.java:327)
>         at 
> org.apache.cxf.transport.http.HTTPConduit.<init>(HTTPConduit.java:296)
>         at 
> org.apache.cxf.transport.http.AbstractHTTPTransportFactory.getConduit(AbstractHTTPTransportFactory.java:159)
>         at 
> org.apache.cxf.transport.http.AbstractHTTPTransportFactory.getConduit(AbstractHTTPTransportFactory.java:146)
>         at 
> org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:73)
>         at 
> org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61)
>         at 
> org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:424)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
>         at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>         at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
> because  the CXF bus is not initialized.
> <beans xmlns="http://www.springframework.org/schema/beans"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xmlns:jaxws="http://cxf.apache.org/jaxws";
>   xmlns:p="http://cxf.apache.org/policy"; 
> xmlns:cxf="http://cxf.apache.org/core";
>   xsi:schemaLocation="
>   http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>   http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
>   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>
>   
>   <bean id="mapAggregator" 
> class="org.apache.cxf.ws.addressing.MAPAggregator"/>
>   <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
>   <bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor">
>     <property name="bus" ref="cxf"/>
>   </bean>
>   <bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor">
>     <property name="bus" ref="cxf"/>
>   </bean>
>   <bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
>   <p:engine enabled="true" ignoreUnknownAssertions="true"/>
>       
>   <cxf:bus name="cxf">
>     <cxf:inInterceptors>
>         <ref bean="mapAggregator"/>
>         <ref bean="mapCodec"/>
>         <ref bean="rmLogicalIn"/>
>         <ref bean="rmCodec"/>
>     </cxf:inInterceptors>
>     <cxf:inFaultInterceptors>
>         <ref bean="mapAggregator"/>
>         <ref bean="mapCodec"/>
>         <ref bean="rmLogicalIn"/>
>         <ref bean="rmCodec"/>
>     </cxf:inFaultInterceptors>
>     <cxf:outInterceptors>
>         <ref bean="mapAggregator"/>
>         <ref bean="mapCodec"/>
>         <ref bean="rmLogicalOut"/>
>         <ref bean="rmCodec"/>
>     </cxf:outInterceptors>
>     <cxf:outFaultInterceptors>
>         <ref bean="mapAggregator"/>
>         <ref bean="mapCodec"/>
>         <ref bean="rmLogicalOut"/>
>         <ref bean="rmCodec"/>
>     </cxf:outFaultInterceptors>
>   </cxf:bus>
>  </beans>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to