java - Latest Jersey example does not work -
i have isntalled latest version of bailiwick of jersey (bundle-version: 2.13.0) , examples version. tried (for testing restful services - \examples\helloworld-pure-jax-rs\src\main\java\org\glassfish\jersey\examples) hello world illustration in eclipse. result ist this:
"hello world" bailiwick of jersey illustration application exception in thread "main" java.lang.illegalargumentexception: no container provider supports type interface com.sun.net.httpserver.httphandler @ org.glassfish.jersey.server.containerfactory.createcontainer(containerfactory.java:87) @ org.glassfish.jersey.server.internal.runtimedelegateimpl.createendpoint(runtimedelegateimpl.java:71) @ org.glassfish.jersey.examples.helloworld.jaxrs.app.startserver(app.java:72) @ org.glassfish.jersey.examples.helloworld.jaxrs.app.main(app.java:88)
i thought illustration should work out of box not utilize 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 thought wrong or missed?
best klemens
with maven , eclipse
first tried maven command line (you need maven installed). worked fine.
steps:
downloaded jersey 2.13 examples bundle here unzipped${myjerseyexamplelocation}
(whatever location may be) cd ${myjerseyexamplelocation}/jersey/examples/helloworld-pure-jax-rs
mvn package
- downloaded dependencies , ran 1 unit test helloworldtest
successfully to run main app mvn exec:java
. runs app
class through exec-maven-plugin listed in <plugins>
section of pom. result:
application started. seek accessing http://localhost:8080/helloworld in browser. nail come in stop application...
from browser to http://localhost:8080/helloworld
. result hello world!
go command line , nail come in stop server from eclipse:
i first delete entire unzipped example, built. wanted scratch eclipse.
steps:
unzipped from eclipseimport -> maven -> existing maven projects
browse helloworld-pure-jax-rs
, select select finish
right click on project run -> maven build
. in dialog in goals
field type package
apply -> run
. grab dependencies. should build successful
along successful unit test. two options run: open app
class, right click , run -> java application
. should same result in eclipse console mention maven step 5. right click on project, select run -> maven build
(there 2 select 1 haven't selected yet previous step). dialog again. allows configure different run configuration. in goals
type exec:java
. run. should same result above. in eclipse environment, tested 1.7.0_65 , 1.8.0_20
hopefully can work. allow me know come with.
java eclipse http jersey
No comments:
Post a Comment