This repository was archived by the owner on May 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
This repository was archived by the owner on May 28, 2018. It is now read-only.
"Chapter 1 Getting Started" fails at unit tests #3584
Copy link
Copy link
Closed
Description
The "Getting Started" tutorial (chapter 1; https://jersey.github.io/documentation/latest/getting-started.html) ist wrong. One cannot execute the code created by the archetype.
Steps to reproduce
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example -DarchetypeVersion=2.26-b05
mvn test
Expected result
Creates source code, compiles it, then starts Jersey 2.26-b05 ontop of Grizzly.
Actual result
Fails when starting Jersey with the following exception:
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ simple-service ---
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: InjectionManagerFactory not found.
at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98)
at org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:93)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:269)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:334)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:116)
at com.example.Main.startServer(Main.java:29)
at com.example.Main.main(Main.java:38)
... 6 more
Workaround
Add a dependency to jersey-hk2 to the generated pom.
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
nvurgaft, jessewriter, RishikeshDarandale, BilalDja and celinederoland
Metadata
Metadata
Assignees
Labels
No labels