[ 
https://issues.apache.org/jira/browse/CXF-3410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-3410.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.4
                   2.4
         Assignee: Daniel Kulp

> org.apache.cxf.ws.policy.PolicyAnnotationListener throws NPE on endpoints 
> with wsdlURL only (i.e. no serviceClass)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-3410
>                 URL: https://issues.apache.org/jira/browse/CXF-3410
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.3.2, 2.3.3
>         Environment: Apache Camel context, Maven project
>            Reporter: Anestis Georgiadis
>            Assignee: Daniel Kulp
>             Fix For: 2.4, 2.3.4
>
>
> Camel context is configured to create a CXF endpoint through use of a WSDL 
> file only (i.e. no implementor). Spring configuration definition is as 
> follows:
> {code:xml}
> <cxf:cxfEndpoint id="nireusV5"
>               address="http://10.234.2.81:8080/nireus/v5";
>               wsdlURL="classpath:wsdl/nireus_old.wsdl">
>       <cxf:properties>
>               <entry key="dataFormat" value="PAYLOAD" />
>       </cxf:properties>
> </cxf:cxfEndpoint>
> {code}
> Maven dependencies include cxf-rt-ws-policy and cxf-rt-ws-security modules, 
> in an attempt to introduce use of WS-SecurityPolicy in the endpoint. When the 
> camel context is starting up, the following NPE is raised:
> {code}
> Caused by: java.lang.NullPointerException
>         at 
> org.apache.cxf.ws.policy.PolicyAnnotationListener.addPolicies(PolicyAnnotationListener.java:210)
>         at 
> org.apache.cxf.ws.policy.PolicyAnnotationListener.handleEvent(PolicyAnnotationListener.java:84)
>         at 
> org.apache.cxf.service.factory.AbstractServiceFactoryBean.sendEvent(AbstractServiceFactoryBean.java:73)
>         at 
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:179)
>         at 
> org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:251)
> {code}
> PolicyAnnotationListener.addPolicies(...) method code is trying to get any 
> declared @Policy or @Policies annotations on the class object that is being 
> passed as argument. This object though is null, probably because no 
> implementor object or service class is declared on the endpoint (I'm using 
> just a WSDL).
> The problem is solved, and the context is properly started-up, if the method 
> is modified as follows:
> {code:java}
>     private void addPolicies(AbstractServiceFactoryBean factory, Server 
> server, Class<?> cls) {
>         List<Policy> list = 
> CastUtils.cast((List<?>)server.getEndpoint().getEndpointInfo()
>                                            
> .getInterface().removeProperty(EXTRA_POLICIES));
>         if (list != null) {
>             addPolicies(factory, server.getEndpoint(), cls, list, 
> Policy.Placement.BINDING);
>         }
>         // --- Start of modification ---
>         if (cls == null) {
>             return;
>         }
>         // --- End of modification ---
>     ...
> {code}
> I can provide a sample application to exhibit the problem, if that helps.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to