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?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&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?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&dataFormat=MESSAGE" >> /> >> <to >> >> uri="cxf://http://localhost:8082/fooServer1-0.0.1b-SNAPSHOT/echo?wsdlURL=http://localhost:8082/fooServer1-0.0.1b-SNAPSHOT/echo?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&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?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&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?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&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?wsdl&serviceName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoService&portName={http://www.telecats.nl/nl.telecats.bvibluenode.adt.server-push.fooService}EchoServiceImplPort&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 >>> >>> >> > > > -- View this message in context: http://old.nabble.com/Problem-with-CXF-Failover--%3E-Already-connected-error-tp27909261p27920470.html Sent from the Camel - Users mailing list archive at Nabble.com.