cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aki Yoshida <sapa...@googlemail.com>
Subject Re: WSDL with ws-policy entries throwing an NPE at AbstractPolicyOperator's normalizeOperator
Date Sat, 25 Sep 2010 16:00:17 GMT
Hi Dan,
Thanks for your advice. It turned out the real problem was actually in
the WSDL file.

The original WSDL file was large, so I tried to make a simpler one
based on hello_world_rm.wsdl by adding the same policy usage. Then, I
noticed that the policy reference was incorrectly referenced in the
original WSDL. By fixing this wrong usage, the NPE disappeared.

So, the problem has been solved. But I think throwing another
exception would be more appropriate than throwing the NPE, so for now,
I explain what caused this error.

The broken WSDL had something like:

    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
       <wsp:Policy>
         <wsp:PolicyReference URI="#binding_policy"/>
       </wsp:Policy>

instead of the correct way of:

   <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
       <wsp:PolicyReference URI="#binding_policy"/>

Then, this lead to the NPE at
Caused by: java.lang.NullPointerException
	at org.apache.neethi.AbstractPolicyOperator.normalizeOperator(AbstractPolicyOperator.java:116)
	at org.apache.neethi.AbstractPolicyOperator.normalize(AbstractPolicyOperator.java:73)
	at org.apache.neethi.Policy.normalize(Policy.java:64)
	at org.apache.neethi.Policy.normalize(Policy.java:49)
	at org.apache.cxf.ws.policy.EndpointPolicyImpl.initializePolicy(EndpointPolicyImpl.java:144)
	at org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize(EndpointPolicyImpl.java:131)
	at org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:482)
	at org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:229)
	at org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:211)
	at org.apache.cxf.transport.http.policy.PolicyUtils.getClient(PolicyUtils.java:150)
        ...

I will look into it to see where we can detect this usage and throw
another exception.

Thanks.
Regards, aki

On Fri, Sep 24, 2010 at 10:12 PM, Daniel Kulp <dkulp@apache.org> wrote:
>
> Honestly, without seeing the wsdl/policies, I'm not sure what to suggest to
> look at.  If you could create a small example and attach to a JIRA, that could
> potentially be a start.
>
> Dan
>
>
> On Thursday 23 September 2010 10:25:15 am Aki Yoshida wrote:
>> Hi,
>> When I use a WSDL file with some ws-policy entries, I am getting an
>> NPE from my CXF client (2.2.9/10/11 and trunk).
>> I was wondering if there is some configuration issue or there is some
>> issue with the way how CXF uses neethi.
>>
>> As I observed, both org.apache.cxf.ws.policy.EffectivePolicyImpl and
>> org.apache.cxf.ws.policy.EndpointPolicyImpl lead to a call
>> policy.normalize(true), where policy is an instance of
>> org.apache.neethi.Policy.
>>
>> And this method of Policy in neethi 2.0.4 calls another method with
>> the policy registry parameter set as null.
>>
>> org.apache.neethi.Policy
>>  48:    public PolicyComponent normalize(boolean deep) {
>>  49:        return normalize(null, deep);
>>  50:    }
>>
>> This method subsequently calls AbstractPolicyOperator's
>> normalizeOperator. Since parameter reg is given as null, line 116 of
>> this method is throwing an NPE.
>>
>> org.apache.neethi.AbstractPolicyOperator
>>  77:    private static PolicyComponent
>> normalizeOperator(PolicyOperator operator, PolicyRegistry reg, boolean
>> deep) {
>>  78:
>>  79:        short type = operator.getType();
>>         ...
>> 114:            } else if (policyComponent.getType() ==
>> Constants.TYPE_POLICY_REF) {
>> 115:                String uri = ((PolicyReference)
>> policyComponent).getURI(); 116:                policyComponent =
>> reg.lookup(uri);
>>
>> Can someone give an advice here how to solve this problem without
>> modifying the WSDL?
>>
>> Thanks.
>> Regards, aki
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Mime
View raw message