jersey: IllegalStateException: InjectionManagerFactory

——————————————————-
T E S T S
——————————————————-
Running org.luohuahuang.MyResourceTest
十一月 13, 2017 5:34:48 下午 org.glassfish.jersey.test.grizzly.GrizzlyTestContai
nerFactory$GrizzlyTestContainer <init>
信息: Creating GrizzlyTestContainer configured at the base URI http://localhost:
9998/
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.307 sec <<< FA
ILURE!
testGetIt(org.luohuahuang.MyResourceTest) Time elapsed: 0.098 sec <<< ERROR!
java.lang.IllegalStateException: InjectionManagerFactory not found.
at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManage
rFactory(Injections.java:97)
at org.glassfish.jersey.internal.inject.Injections.createInjectionManage
r(Injections.java:89)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHand
ler.java:282)

 

Solution:

Add the following dependency to the $project/pom.xml,

<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>