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