I have isntalled the latest version of jersey (Bundle-Version: 2.13.0) and the examples for that version. Then I tried (for testing Restful services - \examples\helloworld-pure-jax-rs\src\main\java\org\glassfish\jersey\examples) the Hello World example in Eclipse. The result ist this:
"Hello World" Jersey Example Application
Exception in thread "main" java.lang.IllegalArgumentException: No container provider supports the type interface com.sun.net.httpserver.HttpHandler
at org.glassfish.jersey.server.ContainerFactory.createContainer(ContainerFactory.java:87)
at org.glassfish.jersey.server.internal.RuntimeDelegateImpl.createEndpoint(RuntimeDelegateImpl.java:71)
at org.glassfish.jersey.examples.helloworld.jaxrs.App.startServer(App.java:72)
at org.glassfish.jersey.examples.helloworld.jaxrs.App.main(App.java:88)
I thought the example should work out of the box as it does not use any specific http servers. Only
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
My Java version is:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)
Any idea what could be wrong or what I missed?
best Klemens
In my case I was following an example. Finally I only needed to add this dependency org.glassfish.jersey.containers
jersey-container-jdk-http
(remember the exception's message "No container provider supports the type interface com.sun.net.httpserver.HttpHandler"):
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jdk-http</artifactId>
<version>2.18</version>
</dependency>
You could change the version according your environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With