문제

i'm working on a project where i have an embedded jetty server for serving html admin pages and i need to integrate some web services. I use jax-ws and javax xml annotations to build thoses services and use the jetty SPI implementation (jetty-jaxws2-spi) to replace default HttpServerProvider:

...
System.setProperty("com.sun.net.httpserver.HttpServerProvider","org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider");
HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress(serverPort),0);
...
HttpContext httpContext = httpsServer.createContext("/ws/myservice");
Endpoint endpoint = Endpoint.create(new AuthenticateImpl());
endpoint.publish(httpContext);
...

The web service work fine, but when i throw a webfault exception, the client only get HTTP 200 result code with no body content. I switch the httpserverprovider back to default implementation, and the fault is send correctly to the client.

I think something is missing in jetty-jaxws2-spi implementation, but don't know what.

any idea ?

update: it seems to be a compatibility problem between JAVA version and JAX libs.

with java7 and jaxb-api and jaxb-impl (2.1.12) in endorsed dir I get:

java.lang.ExceptionInInitializerError
at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:254)
at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:85)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:299)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:593)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
at org.eclipse.jetty.jaxws2spi.JAXWS2ContextHandler.doScope(JAXWS2ContextHandler.java:75)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:550)
... 25 more

and lead to default http response (200)...

update 2

i get webfault working when i remove jaxb-impl and jaxb-api from my endorsed directory. but if i do that, i can't get Natural JSON notation from jersey, jaxb 2.1.12 required. damn ...

도움이 되었습니까?

해결책

Resolved:

add JAX-WS RI 2.1.7 and JAXB 2.1.12 jars in my endorsed dir.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top