You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by wasew <wa...@gmail.com> on 2014/02/21 11:25:57 UTC

NullPointerException on Policy merge

What can this mean?

Exception: 
java.lang.NullPointerException
	at org.apache.neethi.Policy.merge(Policy.java:109)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationTokenInterceptorProvider.setupClient(SecureConversationTokenInterceptorProvider.java:86)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.issueToken(SecureConversationOutInterceptor.java:152)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:69)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:44)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
	at $Proxy36.getOffer(Unknown Source)
	at client.WSLebenClient.main(WSLebenClient.java:75)
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault
string, and possibly fault code, not set
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
	at $Proxy36.getOffer(Unknown Source)
	at client.WSLebenClient.main(WSLebenClient.java:75)
Caused by: java.lang.NullPointerException
	at org.apache.neethi.Policy.merge(Policy.java:109)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationTokenInterceptorProvider.setupClient(SecureConversationTokenInterceptorProvider.java:86)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.issueToken(SecureConversationOutInterceptor.java:152)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:69)
	at
org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:44)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
	... 2 more



--
View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-on-Policy-merge-tp5740289.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: NullPointerException on Policy merge

Posted by Colm O hEigeartaigh <co...@apache.org>.
You need a BootstrapPolicy in your WSDL as per the following link:

https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob_plain;f=systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/secconv/DoubleItSecConv.wsdl;hb=HEAD

The client needs to get a SecureConversationToken as per the existing
policy. The BootstrapPolicy is used to communicate with the STS to get the
SecureConverationToken.

Colm.


On Sat, Feb 22, 2014 at 4:24 PM, wasew <wa...@gmail.com> wrote:

> Hi. Thank you. What must I set?
>
> My client Request Header must look like this:
>
> <soapenv:Header>
>     <wsse:Security
> xmlns:wsse="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
> "
> xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc">
>       <wsc:SecurityContextToken>
>         <wsc:Identifier></wsc:Identifier>
>       </wsc:SecurityContextToken>
>     </wsse:Security>
>   </soapenv:Header>
>
> My Policy on WSDL is:
> <wsp:Policy xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy
> "
>                 xmlns:wsa="
> http://schemas.xmlsoap.org/ws/2004/08/addressing"
>                 xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
>
> xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> "
>                 wsu:Id="AuthSecurityPolicy">
>                 <wsp:ExactlyOne>
>                         <wsp:All>
>                                 <sp:TransportBinding>
>                                         <wsp:Policy>
>                                                 <sp:TransportToken>
>                                                         <wsp:Policy>
>
> <sp:HttpsToken RequireClientCertificate="false" />
>                                                         </wsp:Policy>
>                                                 </sp:TransportToken>
>                                         </wsp:Policy>
>                                 </sp:TransportBinding>
>                                 <sp:SupportingTokens>
>                                         <wsp:Policy>
>                                                 <sp:SecureConversationToken
>
> sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient
> ">
>                                                         <sp:Issuer>
>
> <wsa:Address>
>
> Address to STS
>
> </wsa:Address>
>                                                         </sp:Issuer>
>
> </sp:SecureConversationToken>
>                                         </wsp:Policy>
>                                 </sp:SupportingTokens>
>                         </wsp:All>
>                 </wsp:ExactlyOne>
>         </wsp:Policy>
>
> WS-Security is new for me!
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/NullPointerException-on-Policy-merge-tp5740289p5740355.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: NullPointerException on Policy merge

Posted by wasew <wa...@gmail.com>.
Hi. Thank you. What must I set?

My client Request Header must look like this:

<soapenv:Header>
    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc">
      <wsc:SecurityContextToken>
        <wsc:Identifier></wsc:Identifier>
      </wsc:SecurityContextToken>
    </wsse:Security>
  </soapenv:Header>

My Policy on WSDL is:
<wsp:Policy xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
		xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
		xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
	
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
		wsu:Id="AuthSecurityPolicy">
		<wsp:ExactlyOne>
			<wsp:All>
				<sp:TransportBinding>
					<wsp:Policy>
						<sp:TransportToken>
							<wsp:Policy>
								<sp:HttpsToken RequireClientCertificate="false" />
							</wsp:Policy>
						</sp:TransportToken>
					</wsp:Policy>
				</sp:TransportBinding>
				<sp:SupportingTokens>
					<wsp:Policy>
						<sp:SecureConversationToken
						
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
							<sp:Issuer>
								<wsa:Address>
									Address to STS
								</wsa:Address>
							</sp:Issuer>
						</sp:SecureConversationToken>
					</wsp:Policy>
				</sp:SupportingTokens>
			</wsp:All>
		</wsp:ExactlyOne>
	</wsp:Policy>

WS-Security is new for me!



--
View this message in context: http://cxf.547215.n5.nabble.com/NullPointerException-on-Policy-merge-tp5740289p5740355.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: NullPointerException on Policy merge

Posted by Colm O hEigeartaigh <co...@apache.org>.
It looks like your "SecureConverationToken" does not have a
BootstrapPolicy. Here is an example:

https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob_plain;f=systests/ws-security-examples/src/test/resources/org/apache/cxf/systest/wssec/examples/secconv/DoubleItSecConv.wsdl;hb=HEAD

I will fix the NPE.

Colm.


On Fri, Feb 21, 2014 at 10:25 AM, wasew <wa...@gmail.com> wrote:

> What can this mean?
>
> Exception:
> java.lang.NullPointerException
>         at org.apache.neethi.Policy.merge(Policy.java:109)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationTokenInterceptorProvider.setupClient(SecureConversationTokenInterceptorProvider.java:86)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.issueToken(SecureConversationOutInterceptor.java:152)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:69)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:44)
>         at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>         at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
>         at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
>         at $Proxy36.getOffer(Unknown Source)
>         at client.WSLebenClient.main(WSLebenClient.java:75)
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault
> string, and possibly fault code, not set
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
>         at $Proxy36.getOffer(Unknown Source)
>         at client.WSLebenClient.main(WSLebenClient.java:75)
> Caused by: java.lang.NullPointerException
>         at org.apache.neethi.Policy.merge(Policy.java:109)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationTokenInterceptorProvider.setupClient(SecureConversationTokenInterceptorProvider.java:86)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.issueToken(SecureConversationOutInterceptor.java:152)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:69)
>         at
>
> org.apache.cxf.ws.security.policy.interceptors.SecureConversationOutInterceptor.handleMessage(SecureConversationOutInterceptor.java:44)
>         at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>         at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
>         at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
>         ... 2 more
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/NullPointerException-on-Policy-merge-tp5740289.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com