Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Exception deploying Servlet and Metro WS

You are hitting this requirement ...

https://github.com/eclipse/jetty.project/blob/master/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServer.java#L131

To fix, change:

Server server = new Server(8080);

to

Server server = new Server(new DelegatingThreadPool()); // <-- required for http-spi
ServerConnector connector = new ServerConnector(server);
connector.setPort(8080);  // <-- your port is now set via a connector
server.addConnector(connector);

and try again.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Jul 1, 2014 at 2:21 AM, Alejandro Alberola <alberola@xxxxxx> wrote:
Hello,

I have an embedded Jetty 9.2.1 server in my application where I have deployed a
servlet in a ServletContextHandler. At the same time I want to deploy a Metro WS
in the same server using JettyHttpServerProvider, but when I try to publish the
WS Endpoint I get the following exception:

Caused by: com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.lang.UnsupportedOperationException: !DelegatingThreadPool
    at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:102)
    at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:63)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:171)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:118)
    at javax.xml.ws.Endpoint.publish(Endpoint.java:240)

If I use two Jetty server instances embedded in my application and listening in different ports,
all work properly, but I would like to share the same port among the servlet and the Metro WS.

My faulty code follows:

-------------------------------------------------
Server server = new Server(8080);

System.setProperty("com.sun.net.httpserver.HttpServerProvider",
"org.eclipse.jetty.http.spi.JettyHttpServerProvider");
JettyHttpServerProvider.setServer(server);

ContextHandlerCollection contexts = new ContextHandlerCollection();

servletContext =  new ServletContextHandler(server, "/myapp", true, false);
contexts.addHandler(servletContext);

ServletHolder servletHolder = new ServletHolder(MyServlet);
servletContext.addServlet(servletHolder, "/servlet-path");

HandlerCollection handlerCollection = new HandlerCollection();
handlerCollection.setHandlers(new Handler[]{ contexts });

Endpoint endpoint = Endpoint.publish(endpointURL, myWebServices);

server.setHandler(contexts);

server.start();
-------------------------------------------------

Any idea ?
Thanks.

---
Alejandro Alberola
Bio Data Systems
---

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top