Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4875

NPE resolving policy reference

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      This is related to the changes for CXF-4814 [1]. I get the following exception

      java.lang.NullPointerException
      	at org.apache.cxf.ws.policy.WSPolicyFeature.resolveLocal(WSPolicyFeature.java:236)
      	at org.apache.cxf.ws.policy.WSPolicyFeature.resolveReference(WSPolicyFeature.java:225)
      	at org.apache.cxf.ws.policy.WSPolicyFeature.initializeEndpointPolicy(WSPolicyFeature.java:153)
      	at org.apache.cxf.ws.policy.WSPolicyFeature.initialize(WSPolicyFeature.java:118)
      	at org.apache.cxf.frontend.ServerFactoryBean.applyFeatures(ServerFactoryBean.java:248)
      	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:192)
      	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
      	at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:454)
      	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
      	... 30 more
      

      when dealing with a spring descriptor as follows:

      ...
      <wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
          <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
            <wsp:Policy/>
          </wsam:Addressing>
          <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
            <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
          </wsrmp:RMAssertion>
        </wsp:Policy>
        
        <jaxws:endpoint id='TestService' address='http://@jboss.bind.address@:8080/jaxws-cxf-wsrm-basic-rpc' implementor='org.jboss.test.ws.jaxws.cxf.wsrm.BasicRPCEndpointImpl'>
          <jaxws:features>
            <p:policies>
              <wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/ns/ws-policy"/>
            </p:policies>
          </jaxws:features>
        </jaxws:endpoint>
      ...
      

      It seems like the code in WSPolicyFeature::resolveLocal(PolicyReference ref, final Bus bus, DescriptionInfo i) is trying to access the current DescriptionInfo, while that will only be set later in WSPolicyFeature::initialize(Server server, Bus bus) (using the ServiceModelPolicyUpdater::addPolicyAttachments and ServiceModelPolicyUpdater::addPolicy methods)

      [1] http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?r1=1445307&r2=1445306&pathrev=1445307

      Attachments

        Issue Links

          Activity

            People

              ema Jim Ma
              asoldano Alessio Soldano
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: