全部博文(322)
分类: 系统运维
2010-11-12 13:30:46
My goal is to embed Jetty 7 with the ability to serve WebService (SOAP) requests.
All works fine when using Jetty 6 and the org.mortbay.jetty.j2se6 package from
jetty-contrib.
The supplied code was ported to Jetty 7 as follows:
First there is an IllegalStateException
—
2009-11-06 17:37:22.182:DBUG::Container ContextHandlerCollection@29700391 + J2SE6ContextHandler@172fb0af@172fb0af/calc,null as handler
Exception in thread "main" com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.lang.IllegalStateException: STARTED
—
JettyHttpServer.createContext() used to start the jettyContextHandler
in the original code. I disabled this. The state of the handler is already
started.
The next obstacle was the now volatile _handlers in
org.eclipse.jetty.server.handler._handlers. I tried to solve this by
using the first found Handler in the HandlerCollection in
JettyHttpServer.createContext(). This way a client doesn't get 404.
Nonetheless something still must be wrong. A SOAP request like this
—
—
adressing now returns
—
HTTP/1.1 302 Found
Location: htt://localhost:8080/calc/
Content-Length: 0
Server: Jetty(7.0.0.v20091005)
—
Using jetty6 lib (path lib/ in my sample Eclipse project) and using
the unmodified org.mortbay.jetty.j2se6 code I get the expected
—
HTTP/1.1 200 OK
—
If you like to regenerate the WSDL or XSD files you must have JAX-WS
somethere and use the generate-wsdl.sh script.
Thanks for looking into this
Axel