Monday 1 November 2010

Annoying problem with JAX-WS webservice

In order to monitor the connectivity of a webservice I have coded some junit tests which uses a JAX-WS soap client. These tests are fired of using Maven

Most of the time they work great but occasionally I get the following exception

java.lang.AssertionError: the tube must call the add(...) method to register itself before start copying other pipes,but weblogic.wsee.jaxws.tubeline.FlowControlTube$FlowControlAwareTube@834ed06 hasn't done so
at com.sun.xml.ws.api.pipe.TubeCloner.copy(TubeCloner.java:104)
at weblogic.wsee.jaxws.tubeline.FlowControlTube.<init>(FlowControlTube.java:31)
at weblogic.wsee.jaxws.tubeline.FlowControlTube.copy(FlowControlTube.java:50)
at weblogic.wsee.jaxws.tubeline.FlowControlTube.copy(FlowControlTube.java:13)
at com.sun.xml.ws.api.pipe.TubeCloner.copy(TubeCloner.java:102)
at com.sun.xml.ws.api.pipe.TubeCloner.clone(TubeCloner.java:74)
at com.sun.xml.ws.util.Pool$TubePool.create(Pool.java:170)
at com.sun.xml.ws.util.Pool$TubePool.create(Pool.java:161)
at com.sun.xml.ws.util.Pool.take(Pool.java:78)
at com.sun.xml.ws.client.Stub.process(Stub.java:245)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)


I don't know why we get that sometimes, but I have managed to hide the problem. The trick is to know that Maven surefire plugin enables assertions per default. In order to disable this particular assertion I configured the following in Maven POM

<plugin>
<groupId > org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-da:com.sun.xml.ws.api.pipe.TubeCloner</argLine>
</configuration>
</plugin>