dev@ws-test-harness.java.net

Re: running the test harness

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 09 Oct 2007 10:14:14 -0700

Fabian Ritzmann wrote:
> Hi,
>
> I have checked in a few changes to get the Java SE endpoint feature for
> the test harness working.

Cool!

> The basic fix to run WSIT tests was to adorn
> the deployed services with WSDL since WSIT 1.0 doesn't support providers
> without WSDL. However, I am still stuck with two issues and would need
> some advice.
>
> The first issue does not seem to have anything to do with the Java SE
> endpoint, I can reproduce it with the in-VM transport just as well. When
> I run this command (similarly to the run-harness target in the
> build.xml) with Java 5:
>
> java -cp build/dist/harness-lib.jar:build/dist/harness.jar WsTest
> -transport
> /Users/fr159072/workspace/jax-ws-sources/jaxws-ri/transports/local/build/jaxws-local-transport.jar
> -cp:wsit-image
> /Users/fr159072/workspace/wsit_1_0/dist/image/jax-ws-latest-wsit
> /Users/fr159072/workspace/ws-test-harness/test-harness/test/testcases/wsrm/roundtrip

Note that you shouldn't have to put the harness-lib.jar like that in the
classpath. You should be able to just do:

   java -jar build/dist/harness.jar

I've been using it like that all along. If that doesn't work for you,
I'd like to know why.

First, can you make sure you got the latest harness jar? I vaguely
recall seeing something similar not so long time ago, and I think I
fixed that.

Otherwise, can you run the harness with the -debug option and send me
the output? It seems like it's forgetting to pick up some jars.

> I get this:
>
> injected services: pingService
> injected ports: WSHttpBinding_IPing
> injected addresses: WSHttpBinding_IPingAddress
> Sending message0
> Oct 9, 2007 11:25:53 AM
> com.sun.xml.ws.rm.jaxws.runtime.client.RMClientTube processRequest
> SEVERE: WSRM2006: Unexpected Exception in RMClientPipe.process.
> java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at
> org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1197)
> at
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:973)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at com.sun.xml.ws.api.message.Headers.create(Headers.java:95)
> at
> com.sun.xml.ws.rm.jaxws.runtime.OutboundSequence.createHeader(OutboundSequence.java:396)
> at
> com.sun.xml.ws.rm.jaxws.runtime.OutboundSequence.processOutboundMessage(OutboundSequence.java:236)
> at
> com.sun.xml.ws.rm.jaxws.runtime.TubeBase.handleOutboundMessage(TubeBase.java:123)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.RMClientTube.prepareRequestMessage(RMClientTube.java:407)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.RMClientTube.processRequest(RMClientTube.java:528)
> at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
> at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
> at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
> at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
> at com.sun.xml.ws.client.Stub.process(Stub.java:248)
> 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)
> at $Proxy51.echoString(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at bsh.Reflect.invokeOnMethod(Reflect.java:177)
> at bsh.Reflect.invokeObjectMethod(Reflect.java:90)
> at bsh.Name.invokeMethod(Name.java:856)
> at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:72)
> at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
> at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
> at bsh.BSHAssignment.eval(BSHAssignment.java:77)
> at bsh.BSHBlock.evalBlock(BSHBlock.java:130)
> at bsh.BSHBlock.eval(BSHBlock.java:80)
> at bsh.BSHBlock.eval(BSHBlock.java:46)
> at bsh.BSHForStatement.eval(BSHForStatement.java:111)
> at bsh.Interpreter.eval(Interpreter.java:653)
> at
> com.sun.xml.ws.test.client.InterpreterEx.eval(InterpreterEx.java:50)
> at
> com.sun.xml.ws.test.exec.ClientExecutor.invoke(ClientExecutor.java:100)
> at
> com.sun.xml.ws.test.exec.ClientExecutor.runBare(ClientExecutor.java:84)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.textui.TestRunner.doRun(TestRunner.java:116)
> at junit.textui.TestRunner.doRun(TestRunner.java:109)
> at com.sun.xml.ws.test.Main$1.doRun(Main.java:276)
> at com.sun.xml.ws.test.Main.run(Main.java:284)
> at com.sun.xml.ws.test.Main.doMain(Main.java:208)
> at com.sun.xml.ws.test.Main.main(Main.java:196)
> at WsTest.main(WsTest.java:9)
> Exception in thread "Timer-1" java.lang.NullPointerException
> at com.sun.xml.ws.rm.Message.resume(Message.java:273)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.ClientOutboundSequence.resend(ClientOutboundSequence.java:481)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.ClientOutboundSequence.doMaintenanceTasks(ClientOutboundSequence.java:653)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.RMSource.doMaintenanceTasks(RMSource.java:182)
> at
> com.sun.xml.ws.rm.jaxws.runtime.client.RetryTimer$RetryTask.run(RetryTimer.java:100)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
>
> When I add the webservices-api.jar to the Java class path like this:
>
> java -cp
> build/dist/harness-lib.jar:build/dist/harness.jar:../../wsit_1_0/dist/image/jax-ws-latest-wsit/lib/webservices-api.jar
> WsTest ...
>
> The test is running through just fine. This has me stumped. In the first
> case, the code in com.sun.xml.ws.test.Main seems to be adding the
> webservices-api.jar to the class path, but somehow the class loader is
> not picking up on it.
>
>
> Regarding the second issue, I am somewhat unclear how JAX-WS deals with
> providers vs ordinary web services. When I run the service (with a SOAP
> 1.2 binding) as a provider with WSDL and the service port and service
> names don't exactly match the WSDL names, JAX-WS bails out:
>
> com.sun.xml.ws.server.ServerRtException: Cannot generate WSDL for
> binding "http://www.w3.org/2003/05/soap/bindings/HTTP/"
> at
> com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:415)
> at
> com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:196)
> at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
> ...
>
> This is because JAX-WS is examining the WSDL, doesn't find a
> wsdl:service/port that matches the annotations in the service class,
> tries to generate WSDL and fails, because JAX-WS does not allow the
> generation of WSDL for the regular SOAP 1.2 binding. So far so good and
> I can deal with that by explicitly setting the wsdl:port and
> wsdl:service names with the WebService annotation. However, what I
> cannot explain is why this test with bogus port and service names is
> running through when I run it as an ordinary web service instead of a
> provider? Does JAX-WS not compare the names set in the WSDL with what is
> set in the service? Does JAX-WS just take the port/service names from
> the WSDL [1]?
>
> Fabian
>
> [1] I hope it does, otherwise I would not be able to explain how RM
> picks up the policy that is attached to the endpoint.
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com