Frage

Ich arbeite an einem Projekt, in dem ich einen eingebetteten Anlegeserver für die Bereitstellung von HTML-Administrationsseiten habe und einige Webdienste integrieren muss. Ich verwende jax-ws und javax xml-Annotationen, um diese Dienste zu erstellen, und verwende die Jetty-SPI-Implementierung (jetty-jaxws2-spi), um den Standard-HttpServerProvider zu ersetzen:

...
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);
...

Der Webdienst funktioniert einwandfrei, aber wenn ich eine Webfehlerausnahme auslöse, erhält der Client nur HTTP 200-Ergebniscode ohne Textinhalt. Ich schalte den httpserverprovider wieder auf die Standardimplementierung um und der Fehler wird korrekt an den Client gesendet.

Ich denke, in der Implementierung von jetty-jaxws2-spi fehlt etwas, aber ich weiß nicht was.

eine Idee?

  • jetty-jaxws2-spi: https://svn.codehaus.org/jetty/jetty/tags/jetty-7.0.1.v20091125/jetty-jaxws2-spi/

    Update : Es scheint ein Kompatibilitätsproblem zwischen der JAVA-Version und den JAX-Bibliotheken zu sein.

    mit java7 und jaxb-api und jaxb-impl (2.1.12) im indossierten Verzeichnis bekomme ich:

    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
    

    und führen zur Standard-http-Antwort (200) ...

    Update 2

    Webfault funktioniert, wenn ich jaxb-impl und jaxb-api aus meinem indossierten Verzeichnis entferne. aber wenn ich das mache, kann ich keine natürliche JSON-Notation von Jersey bekommen, jaxb 2.1.12 erforderlich. verdammt ...

War es hilfreich?

Lösung

Gelöst :

Fügen Sie JAX-WS RI 2.1.7- und JAXB 2.1.12-Gläser in mein empfohlenes Verzeichnis ein.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top