You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Henri Tremblay <he...@gmail.com> on 2012/01/10 00:05:28 UTC

Using failover with authentication

Hi,

I'm having a CXF client. This client is configured with failover. It is
also configured with http authentication. I'll show you the setup below.

My problem is that both are working separately but not together. The
authentication doesn't work on the alternate addresses. I think it's
because it's not the same conduit.

Can someone help me to setup it?

The failover configuration:

      <jaxws:client id=*"stuff"* serviceClass=*"com.acme.MyService"* address
=*"${main_url}"*>

            <jaxws:features>

                  <clustering:failover>

                        <clustering:strategy>

                             <bean class=*
"org.apache.cxf.clustering.SequentialStrategy"*>

                                   <property name=*"alternateAddresses"*>

                                         <util:list>

                                               <value>${backup_url}</value>

                                         </util:list>

                                   </property>

                             </bean>

                        </clustering:strategy>

                  </clustering:failover>

            </jaxws:features>
      </jaxws:client>

And the code for the authentification:

      @PostConstruct

      *private* *void* makeDigestHttpAuth() {

            *final* Client proxy = ClientProxy.*getClient*(clientProxy);

            *final* HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

            *final* AuthorizationPolicy authorizationPolicy =
*new*AuthorizationPolicy();

            authorizationPolicy.setUserName(userName);

            authorizationPolicy.setPassword(password);

            conduit.setAuthorization(authorizationPolicy);

            conduit.setAuthSupplier(*new* DigestAuthSupplier());
      }

Thanks for your help
-
Henri

Re: NullPointer Exception of JAXWS interface

Posted by xuhb <xu...@tongtech.com>.
Issue raised with a simple test case 
https://issues.apache.org/jira/browse/CXF-4031 
----- Original Message ----- 
From: "Daniel Kulp" <dk...@apache.org>
To: <de...@cxf.apache.org>
Cc: "xuhb" <xu...@tongtech.com>
Sent: Saturday, January 14, 2012 12:35 AM
Subject: Re: NullPointer Exception of JAXWS interface


> On Friday, January 13, 2012 3:41:16 PM xuhb wrote:
>> Hi, Dan:
>>     
>> I've tried the lates version 2.5.1, the problem still exists.  
> 
> Any chance you can create a small "hello world" type test case and submit a 
> JIRA?
> 
>> So maybe you patch hasn't been included in the lates version , could you
>> tell me the issue which you fixed?
> 
> We made some changes down in the core for camel (since camel really wouldn't 
> be using JAX-WS for this).  Thus, it's likely that the JAX-WS/frontend layers 
> may also need some updates for this usecase as well.    A testcase would be a 
> big help.
> 
> Dan
> 
> 
> 
>> Thanks a lot
>> 
>> ----- Original Message ----- 
>> From: "Daniel Kulp" <dk...@apache.org>
>> To: <de...@cxf.apache.org>
>> Cc: "xuhb" <xu...@tongtech.com>
>> Sent: Friday, January 13, 2012 6:52 AM
>> Subject: Re: NullPointer Exception of JAXWS interface
>> 
>> 
>> 
>> > On Wednesday, January 11, 2012 12:14:20 PM xuhb wrote:
>> > 
>> >> Hi:
>> >> 
>> >>  if wsdl operation's input message is empty(zero part), but output
>> >>  message
>>> 
>> >> has multi part. then the generated JAXWS service will raise
>> >> NullPointer
>> >> Exception;
>> > 
>> > Such a wsdl is not practical , only for marginal testing;
>> > 
>> >> 
>> >> version :     CXF-2.3.3;  I haven't try the latest CXF version;
>> > 
>> > 
>> > 
>> > This sounds very familiar to some issues related to empty soap:body
>> > things 
> that I had to fix for some camel related tests.  Thus, it may
>> > already be fixed with a more recent version of CXF.
>> > 
>> > Dan
>> > 
>> > 
>> > 
>> >> 
>> >> Here is a example:
>> >> 
>> >> 
>> >>   <wsdl:message name="notifyRequest">
>> >>   </wsdl:message>
>> >>   <wsdl:message name="notifyReponse">
>> >>   
>> >>     <wsdl:part name="r0" element="ns:SimpleSymbol"/>
>> >>     <wsdl:part name="r1" element="ns:Symbol"/>
>> >>   
>> >>   </wsdl:message>
>> >> 
>> >> 
>> >> 
>> >>    <wsdl:operation name="notify">
>> >>    
>> >>       <wsdl:input message="axis2:notifyRequest">
>> >>     
>> >>     </wsdl:input>
>> >>     
>> >>       <wsdl:output message="axis2:notifyReponse">
>> >>     
>> >>     </wsdl:output>
>> >>    
>> >>    </wsdl:operation>
>> >> 
>> >> 
>> >> JAXWS Operation is :
>> >> public void notify(Holder<String> r0, Holder<SymbolType> r1) {
>> >> }
>> >> 
>> >> Analyse: 
>> >> 
>> >>     Because when <soap:Body> has no child element, the
>> >>     DocLiteralInterceptor
>>> 
>> >> doesn't create a MessageContentsList ( because input is nothing)
>> > 
>> > 
>> > 
>> >>     But HolderInInterceptor will always except the
>> >>     MessageContentsList
>> >> 
>> >> exists; so nullPointer raised while accesing the MessageContentsList
>> > 
>> > 
>> > 
>> >> Exception Stack Trace:
>> >> 
>> >> java.lang.NullPointerException
>> >> 
>> >>  at
>> >> 
>> >> org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(Ho
>> >> lderI
> nInterceptor.java:78)
>> > 
>> > at
>> > 
>> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>> >> rChai
> n.java:255) at
>> >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
>> >> tionO
> bserver.java:113) at
>> >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceReques
>> >> t(Jet
> tyHTTPDestination.java:322) at
>> >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(Jet
>> >> tyHTT
> PDestination.java:291) at
>> >> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPH
>> >> andle
> r.java:72) at
>> >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandle
>> >> r.jav
> a:936) at
>> >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler
>> >> .java
>>> 
>> >> :873) at
>> >> 
>> >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.ja
>> >> va:11
> 7) at
>> >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Conte
>> >> xtHan
> dlerCollection.java:247) at
>> >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.
>> >> java:
> 116) at org.eclipse.jetty.server.Server.handle(Server.java:346)>> 
>> >>  at
>> >> 
>> >> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.j
>> >> ava:5
> 81)
>> > 
>> > at
>> > 
>> >> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpCon
>> >> necti
> on.java:1057) at
>> >> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:807) at
>> >> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
>> >> at
>> >> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:41
>> >> 1) at
>> >> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEn
>> >> dPoint .java:526) at
>> >> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndP
>> >> oint.
> java:41) at
>> >> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.
>> >> java:
> 528) at java.lang.Thread.run(Thread.java:595)
>> > 
>> > -- 
>> > Daniel Kulp
>> > dkulp@apache.org - http://dankulp.com/blog
>> > Talend Community Coder - http://coders.talend.com
> 
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: NullPointer Exception of JAXWS interface

Posted by Daniel Kulp <dk...@apache.org>.
On Friday, January 13, 2012 3:41:16 PM xuhb wrote:
> Hi, Dan:
>     
> I've tried the lates version 2.5.1, the problem still exists.  

Any chance you can create a small "hello world" type test case and submit a 
JIRA?

> So maybe you patch hasn't been included in the lates version , could you
> tell me the issue which you fixed?

We made some changes down in the core for camel (since camel really wouldn't 
be using JAX-WS for this).  Thus, it's likely that the JAX-WS/frontend layers 
may also need some updates for this usecase as well.    A testcase would be a 
big help.

Dan


 
> Thanks a lot
> 
> ----- Original Message ----- 
> From: "Daniel Kulp" <dk...@apache.org>
> To: <de...@cxf.apache.org>
> Cc: "xuhb" <xu...@tongtech.com>
> Sent: Friday, January 13, 2012 6:52 AM
> Subject: Re: NullPointer Exception of JAXWS interface
> 
> 
> 
> > On Wednesday, January 11, 2012 12:14:20 PM xuhb wrote:
> > 
> >> Hi:
> >> 
> >>  if wsdl operation's input message is empty(zero part), but output
> >>  message
>> 
> >> has multi part. then the generated JAXWS service will raise
> >> NullPointer
> >> Exception;
> > 
> > Such a wsdl is not practical , only for marginal testing;
> > 
> >> 
> >> version :     CXF-2.3.3;  I haven't try the latest CXF version;
> > 
> > 
> > 
> > This sounds very familiar to some issues related to empty soap:body
> > things 
 that I had to fix for some camel related tests.  Thus, it may
> > already be fixed with a more recent version of CXF.
> > 
> > Dan
> > 
> > 
> > 
> >> 
> >> Here is a example:
> >> 
> >> 
> >>   <wsdl:message name="notifyRequest">
> >>   </wsdl:message>
> >>   <wsdl:message name="notifyReponse">
> >>   
> >>     <wsdl:part name="r0" element="ns:SimpleSymbol"/>
> >>     <wsdl:part name="r1" element="ns:Symbol"/>
> >>   
> >>   </wsdl:message>
> >> 
> >> 
> >> 
> >>    <wsdl:operation name="notify">
> >>    
> >>       <wsdl:input message="axis2:notifyRequest">
> >>     
> >>     </wsdl:input>
> >>     
> >>       <wsdl:output message="axis2:notifyReponse">
> >>     
> >>     </wsdl:output>
> >>    
> >>    </wsdl:operation>
> >> 
> >> 
> >> JAXWS Operation is :
> >> public void notify(Holder<String> r0, Holder<SymbolType> r1) {
> >> }
> >> 
> >> Analyse: 
> >> 
> >>     Because when <soap:Body> has no child element, the
> >>     DocLiteralInterceptor
>> 
> >> doesn't create a MessageContentsList ( because input is nothing)
> > 
> > 
> > 
> >>     But HolderInInterceptor will always except the
> >>     MessageContentsList
> >> 
> >> exists; so nullPointer raised while accesing the MessageContentsList
> > 
> > 
> > 
> >> Exception Stack Trace:
> >> 
> >> java.lang.NullPointerException
> >> 
> >>  at
> >> 
> >> org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(Ho
> >> lderI
 nInterceptor.java:78)
> > 
> > at
> > 
> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
> >> rChai
 n.java:255) at
> >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
> >> tionO
 bserver.java:113) at
> >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceReques
> >> t(Jet
 tyHTTPDestination.java:322) at
> >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(Jet
> >> tyHTT
 PDestination.java:291) at
> >> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPH
> >> andle
 r.java:72) at
> >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandle
> >> r.jav
 a:936) at
> >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler
> >> .java
>> 
> >> :873) at
> >> 
> >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.ja
> >> va:11
 7) at
> >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Conte
> >> xtHan
 dlerCollection.java:247) at
> >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.
> >> java:
 116) at org.eclipse.jetty.server.Server.handle(Server.java:346)>> 
> >>  at
> >> 
> >> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.j
> >> ava:5
 81)
> > 
> > at
> > 
> >> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpCon
> >> necti
 on.java:1057) at
> >> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:807) at
> >> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
> >> at
> >> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:41
> >> 1) at
> >> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEn
> >> dPoint .java:526) at
> >> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndP
> >> oint.
 java:41) at
> >> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.
> >> java:
 528) at java.lang.Thread.run(Thread.java:595)
> > 
> > -- 
> > Daniel Kulp
> > dkulp@apache.org - http://dankulp.com/blog
> > Talend Community Coder - http://coders.talend.com

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: NullPointer Exception of JAXWS interface

Posted by xuhb <xu...@tongtech.com>.
Hi, Dan:
    
I've tried the lates version 2.5.1, the problem still exists. 

So maybe you patch hasn't been included in the lates version , could you tell me the issue which you fixed?

Thanks a lot

----- Original Message ----- 
From: "Daniel Kulp" <dk...@apache.org>
To: <de...@cxf.apache.org>
Cc: "xuhb" <xu...@tongtech.com>
Sent: Friday, January 13, 2012 6:52 AM
Subject: Re: NullPointer Exception of JAXWS interface


> On Wednesday, January 11, 2012 12:14:20 PM xuhb wrote:
>> Hi:
>>  if wsdl operation's input message is empty(zero part), but output message
>> has multi part. then the generated JAXWS service will raise NullPointer
>> Exception;
> Such a wsdl is not practical , only for marginal testing;
>> 
>> version :     CXF-2.3.3;  I haven't try the latest CXF version;
> 
> 
> This sounds very familiar to some issues related to empty soap:body things 
> that I had to fix for some camel related tests.  Thus, it may already be fixed 
> with a more recent version of CXF.
> 
> Dan
> 
> 
>> 
>> Here is a example:
>> 
>>   <wsdl:message name="notifyRequest">
>>   </wsdl:message>
>>   <wsdl:message name="notifyReponse">
>>     <wsdl:part name="r0" element="ns:SimpleSymbol"/>
>>     <wsdl:part name="r1" element="ns:Symbol"/>
>>   </wsdl:message>
>> 
>>    <wsdl:operation name="notify">
>>       <wsdl:input message="axis2:notifyRequest">
>>     </wsdl:input>
>>       <wsdl:output message="axis2:notifyReponse">
>>     </wsdl:output>
>>    </wsdl:operation>
>> 
>> JAXWS Operation is :
>> public void notify(Holder<String> r0, Holder<SymbolType> r1) {
>> }
>> 
>> Analyse: 
>>     Because when <soap:Body> has no child element, the DocLiteralInterceptor
>> doesn't create a MessageContentsList ( because input is nothing)
> 
>>     But HolderInInterceptor will always except the MessageContentsList
>> exists; so nullPointer raised while accesing the MessageContentsList
> 
>> Exception Stack Trace:
>> 
>> java.lang.NullPointerException
>>  at
>> org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderI
>> nInterceptor.java:78)
> at
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
>> n.java:255) at
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO
>> bserver.java:113) at
>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jet
>> tyHTTPDestination.java:322) at
>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTT
>> PDestination.java:291) at
>> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandle
>> r.java:72) at
>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.jav
>> a:936) at
>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java
>> :873) at
>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:11
>> 7) at
>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHan
>> dlerCollection.java:247) at
>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:
>> 116) at org.eclipse.jetty.server.Server.handle(Server.java:346)
>>  at
>> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:5
>> 81)
> at
>> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnecti
>> on.java:1057) at
>> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:807) at
>> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220) at
>> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint
>> .java:526) at
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.
>> java:41) at
>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:
>> 528) at java.lang.Thread.run(Thread.java:595)
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: NullPointer Exception of JAXWS interface

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday, January 11, 2012 12:14:20 PM xuhb wrote:
> Hi:
>  if wsdl operation's input message is empty(zero part), but output message
> has multi part. then the generated JAXWS service will raise NullPointer
> Exception;
 Such a wsdl is not practical , only for marginal testing;
> 
> version :     CXF-2.3.3;  I haven't try the latest CXF version;


This sounds very familiar to some issues related to empty soap:body things 
that I had to fix for some camel related tests.  Thus, it may already be fixed 
with a more recent version of CXF.

Dan


> 
> Here is a example:
> 
>   <wsdl:message name="notifyRequest">
>   </wsdl:message>
>   <wsdl:message name="notifyReponse">
>     <wsdl:part name="r0" element="ns:SimpleSymbol"/>
>     <wsdl:part name="r1" element="ns:Symbol"/>
>   </wsdl:message>
> 
>    <wsdl:operation name="notify">
>       <wsdl:input message="axis2:notifyRequest">
>     </wsdl:input>
>       <wsdl:output message="axis2:notifyReponse">
>     </wsdl:output>
>    </wsdl:operation>
> 
> JAXWS Operation is :
> public void notify(Holder<String> r0, Holder<SymbolType> r1) {
> }
> 
> Analyse: 
>     Because when <soap:Body> has no child element, the DocLiteralInterceptor
> doesn't create a MessageContentsList ( because input is nothing)
 
>     But HolderInInterceptor will always except the MessageContentsList
> exists; so nullPointer raised while accesing the MessageContentsList
 
> Exception Stack Trace:
> 
> java.lang.NullPointerException
>  at
> org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderI
> nInterceptor.java:78)
 at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:255) at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO
> bserver.java:113) at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jet
> tyHTTPDestination.java:322) at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTT
> PDestination.java:291) at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandle
> r.java:72) at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.jav
> a:936) at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java
> :873) at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:11
> 7) at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHan
> dlerCollection.java:247) at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 116) at org.eclipse.jetty.server.Server.handle(Server.java:346)
>  at
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:5
> 81)
 at
> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnecti
> on.java:1057) at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:807) at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220) at
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint
> .java:526) at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.
> java:41) at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:
> 528) at java.lang.Thread.run(Thread.java:595)
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

NullPointer Exception of JAXWS interface

Posted by xuhb <xu...@tongtech.com>.
Hi:
 if wsdl operation's input message is empty(zero part), but output message has multi part. then the generated JAXWS service will raise NullPointer Exception;
Such a wsdl is not practical , only for marginal testing;

version :     CXF-2.3.3;  I haven't try the latest CXF version;

Here is a example:

  <wsdl:message name="notifyRequest">
  </wsdl:message>
  <wsdl:message name="notifyReponse">
    <wsdl:part name="r0" element="ns:SimpleSymbol"/>
    <wsdl:part name="r1" element="ns:Symbol"/>
  </wsdl:message>

   <wsdl:operation name="notify">
      <wsdl:input message="axis2:notifyRequest">
    </wsdl:input>
      <wsdl:output message="axis2:notifyReponse">
    </wsdl:output>
   </wsdl:operation>

JAXWS Operation is :
public void notify(Holder<String> r0, Holder<SymbolType> r1) {
}

Analyse: 
    Because when <soap:Body> has no child element, the DocLiteralInterceptor doesn't create a MessageContentsList ( because input is nothing)

    But HolderInInterceptor will always except the MessageContentsList exists; so nullPointer raised while accesing the MessageContentsList

Exception Stack Trace:

java.lang.NullPointerException
 at org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:78)
 at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
 at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
 at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:322)
 at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:291)
 at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:936)
 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:873)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
 at org.eclipse.jetty.server.Server.handle(Server.java:346)
 at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
 at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1057)
 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:807)
 at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
 at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
 at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)
 at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)
 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
 at java.lang.Thread.run(Thread.java:595)

Re: Using failover with authentication

Posted by Henri Tremblay <he...@gmail.com>.
Gotcha.I've answered my own problem.

Configuring the conduit in xml and giving it the correct name worked
perfectly.


On 10 January 2012 17:22, Henri Tremblay <he...@gmail.com> wrote:

> I tried with a conduit configured in XML. Same issue. It is weird since
> both the main and backup URL should have the same conduit name.
>
> Le 10 janv. 2012 00:05, "Henri Tremblay" <he...@gmail.com> a
> écrit :
>
> >
> > Hi,
> >
> > I'm having a CXF client. This client is configured with failover. It is
> also configured with http authentication. I'll show you the setup below.
> >
> > My problem is that both are working separately but not together. The
> authentication doesn't work on the alternate addresses. I think it's
> because it's not the same conduit.
> >
> > Can someone help me to setup it?
> >
> > The failover configuration:
> >
> >       <jaxws:client id="stuff" serviceClass="com.acme.MyService"
> address="${main_url}">
> >
> >             <jaxws:features>
> >
> >                   <clustering:failover>
> >
> >                         <clustering:strategy>
> >
> >                              <bean
> class="org.apache.cxf.clustering.SequentialStrategy">
> >
> >                                    <property name="alternateAddresses">
> >
> >                                          <util:list>
> >
> >
> <value>${backup_url}</value>
> >
> >                                          </util:list>
> >
> >                                    </property>
> >
> >                              </bean>
> >
> >                         </clustering:strategy>
> >
> >                   </clustering:failover>
> >
> >             </jaxws:features>
> >
> >       </jaxws:client>
> >
> > And the code for the authentification:
> >
> >       @PostConstruct
> >
> >       private void makeDigestHttpAuth() {
> >
> >             final Client proxy = ClientProxy.getClient(clientProxy);
> >
> >             final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
> >
> >             final AuthorizationPolicy authorizationPolicy = new
> AuthorizationPolicy();
> >
> >             authorizationPolicy.setUserName(userName);
> >
> >             authorizationPolicy.setPassword(password);
> >
> >             conduit.setAuthorization(authorizationPolicy);
> >
> >             conduit.setAuthSupplier(new DigestAuthSupplier());
> >
> >       }
> >
> > Thanks for your help
> > -
> > Henri
> >
>
>

Re: Using failover with authentication

Posted by Henri Tremblay <he...@gmail.com>.
I tried with a conduit configured in XML. Same issue. It is weird since
both the main and backup URL should have the same conduit name.

Le 10 janv. 2012 00:05, "Henri Tremblay" <he...@gmail.com> a
écrit :
>
> Hi,
>
> I'm having a CXF client. This client is configured with failover. It is
also configured with http authentication. I'll show you the setup below.
>
> My problem is that both are working separately but not together. The
authentication doesn't work on the alternate addresses. I think it's
because it's not the same conduit.
>
> Can someone help me to setup it?
>
> The failover configuration:
>
>       <jaxws:client id="stuff" serviceClass="com.acme.MyService"
address="${main_url}">
>
>             <jaxws:features>
>
>                   <clustering:failover>
>
>                         <clustering:strategy>
>
>                              <bean
class="org.apache.cxf.clustering.SequentialStrategy">
>
>                                    <property name="alternateAddresses">
>
>                                          <util:list>
>
>
<value>${backup_url}</value>
>
>                                          </util:list>
>
>                                    </property>
>
>                              </bean>
>
>                         </clustering:strategy>
>
>                   </clustering:failover>
>
>             </jaxws:features>
>
>       </jaxws:client>
>
> And the code for the authentification:
>
>       @PostConstruct
>
>       private void makeDigestHttpAuth() {
>
>             final Client proxy = ClientProxy.getClient(clientProxy);
>
>             final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
>
>             final AuthorizationPolicy authorizationPolicy = new
AuthorizationPolicy();
>
>             authorizationPolicy.setUserName(userName);
>
>             authorizationPolicy.setPassword(password);
>
>             conduit.setAuthorization(authorizationPolicy);
>
>             conduit.setAuthSupplier(new DigestAuthSupplier());
>
>       }
>
> Thanks for your help
> -
> Henri
>

Re: Using failover with authentication

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 09/01/12 23:05, Henri Tremblay wrote:
> Hi,
>
> I'm having a CXF client. This client is configured with failover. It is
> also configured with http authentication. I'll show you the setup below.
>
> My problem is that both are working separately but not together. The
> authentication doesn't work on the alternate addresses. I think it's
> because it's not the same conduit.
>
> Can someone help me to setup it?
>
> The failover configuration:
>
>        <jaxws:client id=*"stuff"* serviceClass=*"com.acme.MyService"* address
> =*"${main_url}"*>
>
>              <jaxws:features>
>
>                    <clustering:failover>
>
>                          <clustering:strategy>
>
>                               <bean class=*
> "org.apache.cxf.clustering.SequentialStrategy"*>
>
>                                     <property name=*"alternateAddresses"*>
>
>                                           <util:list>
>
>                                                 <value>${backup_url}</value>
>
>                                           </util:list>
>
>                                     </property>
>
>                               </bean>
>
>                          </clustering:strategy>
>
>                    </clustering:failover>
>
>              </jaxws:features>
>        </jaxws:client>
>
> And the code for the authentification:
>
>        @PostConstruct
>
>        *private* *void* makeDigestHttpAuth() {
>
>              *final* Client proxy = ClientProxy.*getClient*(clientProxy);
>
>              *final* HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
>
>              *final* AuthorizationPolicy authorizationPolicy =
> *new*AuthorizationPolicy();
>
>              authorizationPolicy.setUserName(userName);
>
>              authorizationPolicy.setPassword(password);
>
>              conduit.setAuthorization(authorizationPolicy);
>
>              conduit.setAuthSupplier(*new* DigestAuthSupplier());
>        }
>
> Thanks for your help

I suspect you may need to manage it outside of the PostConstruct 
handler, perhaps in the Spring config or at the level of the custom CXF 
outbound interceptor

Cheers, Sergey

> -
> Henri
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com