camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Problem with CXF Failover -> Already connected error
Date Wed, 17 Mar 2010 01:44:41 GMT
I think the failover route could work when the first service is not 
started. Can you give it a try ?
But your test case is special, the exception is thrown when the cxf 
client try to write a message to a closed connection (a tcp dump could 
show more detail information). So I think you may also add this 
exception (or soap fault) into the failover check list.

I can see current failover can't filter the soap fault with cetain error 
message, that is a enhance requirement, I'd be happy to work on this 
when I get time, so please feel free to log a JIRA[1] for it.

[1]http://issues.apache.org/activemq/browse/CAMEL

Willem

rdomingo wrote:
> I don't understand...do you thinkt it might go wrong on tcp level ?
> 
> After debugging I found out it tries to failover to the second service, but
> during this attempt the  Exception is thrown in the class HttpURLConnection:
>  public void setFixedLengthStreamingMode (int contentLength) {
> 	if (connected) {
> 	    throw new IllegalStateException ("Already connected");
> 	}
> 	if (chunkLength != -1) {
> 	    throw new IllegalStateException ("Chunked encoding streaming mode
> set");
> 	}
> 	if (contentLength < 0) {
> 	    throw new IllegalArgumentException ("invalid content length");
> 	}
> 	fixedContentLength = contentLength;
>     }
> 
> I just have no clue why it is thrown. Or am I looking at the wrong place ?
> 
> Could you or have you ever successfully implemented an cxf failover scenario
> ?
> 
> 
> 
> willem.jiang wrote:
>> I did some search on the CXF user list, but didn't find some useful 
>> information. Can you set up a tcpdump to catch the message to see what 
>> happened.
>>
>> Willem
>>
>> rdomingo wrote:
>>> Hi Willem,
>>>
>>> Thank you for responding.
>>>
>>> I moved the first service to a second tomcat on different port, but still
>>> get same Exceptions :(
>>>
>>> My new route:
>>>         <route>
>>>             <from
>>>                
>>> uri="cxf://http://0.0.0.0:8081/fooServer/echo?wsdlURL=http://localhost:8082/fooServer1-0.0.1b-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>> />
>>>             <loadBalance>
>>>                 <failover>
>>>                     <exception>java.lang.Exception</exception>
>>>                     <exception>java.io.IOException</exception>
>>>                 </failover>
>>>                 <to
>>>                    
>>> uri="cxf://http://localhost:8280/fooServer1-0.0.1a-SNAPSHOT/echo?wsdlURL=http://localhost:8280/fooServer1-0.0.1a-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>> />
>>>                     <to
>>>                    
>>> uri="cxf://http://localhost:8082/fooServer1-0.0.1b-SNAPSHOT/echo?wsdlURL=http://localhost:8082/fooServer1-0.0.1b-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>> />
>>>             </loadBalance>
>>>         </route>
>>>
>>> Soap response:
>>> <soap:Envelope>
>>> −
>>> <soap:Body>
>>> −
>>> <soap:Fault>
>>> <faultcode>soap:Server</faultcode>
>>> <faultstring>Already connected</faultstring>
>>> </soap:Fault>
>>> </soap:Body>
>>> </soap:Envelope>
>>>
>>> Can you provide any other hints ?
>>>
>>>
>>>
>>> willem.jiang wrote:
>>>> Can you try to run the back end service in other box or in different
>>>> port?
>>>> It looks like some underlay HTTP communication error happened when you 
>>>> undeployed the first service.
>>>>
>>>> Willem
>>>>
>>>> rdomingo wrote:
>>>>> I need to implement failover for my webservices, but I can't get it
>>>>> working.
>>>>> I'm struggeling with this for some time and it really is getting a
>>>>> problem.
>>>>> I keep getting error below when it needs to failover:
>>>>> ...
>>>>> org.apache.cxf.interceptor.Fault: Already connected
>>>>> 	at
>>>>> org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:101)
>>>>> 	at
>>>>> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
>>>>> 	at
>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>>>>> ...
>>>>> Caused by: java.lang.IllegalStateException: Already connected
>>>>> 	at
>>>>> java.net.HttpURLConnection.setFixedLengthStreamingMode(HttpURLConnection.java:121)
>>>>> 	at
>>>>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.thresholdNotReached(HTTPConduit.java:1888)
>>>>> 	at
>>>>> org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:99)
>>>>> 	at
>>>>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1979)
>>>>> ...
>>>>>
>>>>> My route seems to work ok when not failing over. I tested my webservice
>>>>> standalone and when I comment out the first webservice in my
>>>>> camelContext
>>>>> (after restarting) the second one works ok.
>>>>>
>>>>> But when I have the failover configured like below, when I undeploy
>>>>> first
>>>>> webservice I get exception above, IT DOESNT FAILOVER :(
>>>>>
>>>>>         <route>
>>>>>             <from
>>>>>                
>>>>> uri="cxf://http://0.0.0.0:8081/fooServer/echo?wsdlURL=http://localhost:8080/fooServer1-0.0.1a-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>>>> />
>>>>>             <loadBalance>
>>>>>                 <failover>
>>>>>                     <exception>java.lang.Exception</exception>
>>>>>                     <exception>java.io.IOException</exception>
>>>>>                 </failover>
>>>>> <!-- first webservice -->
>>>>>                 <to
>>>>>                    
>>>>> uri="cxf://http://localhost:8080/fooServer1-0.0.1a-SNAPSHOT/echo?wsdlURL=http://localhost:8080/fooServer1-0.0.1a-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>>>> />
>>>>> <!-- second webservice -->
>>>>>                     <to
>>>>>                    
>>>>> uri="cxf://http://localhost:8080/fooServer1-0.0.1b-SNAPSHOT/echo?wsdlURL=http://localhost:8080/fooServer1-0.0.1b-SNAPSHOT/echo&#63;wsdl&amp;serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&amp;portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&amp;dataFormat=MESSAGE"
>>>>> />
>>>>>             </loadBalance>
>>>>>         </route>
>>>>>
>>>>> pom.xml snapshot:
>>>>> <dependency>
>>>>>             <groupId>org.apache.camel</groupId>
>>>>>             <artifactId>camel-cxf</artifactId>
>>>>>             <version>2.2.0</version>
>>>>>         </dependency>
>>>>>         <dependency>
>>>>>             <groupId>org.apache.cxf</groupId>
>>>>>             <artifactId>cxf-rt-transports-http-jetty</artifactId>
>>>>>             <version>2.2.6</version>
>>>>>         </dependency>
>>>>>
>>>>> Please help.
>>>>>
>>>>> Raymond
>>>>
>>
>>
> 


Mime
View raw message