欢迎光临
一个有态度、有温度的分享型博客

java.lang.IllegalStateException: InjectionManagerFactory not found解决办法

使用Jersey实现 REST web service时,访问服务报错:


HTTP Status 500 - Servlet.init() for servlet Jersey REST Service threw exception root cause java.lang.IllegalStateException: InjectionManagerFactory not found. org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98) java.util.Optional.orElseThrow(Optional.java:290) org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98) org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:93) org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282) org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335) org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178) org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748)

具体原因是缺少jar包,解决办法是在maven配置文件pom.xml中加入依赖,或者直接到官网下载对应jar包:

<dependency>
    <groupId>org.glassfish.jersey.inject</groupId>
    <artifactId>jersey-hk2</artifactId>
    <version>2.26</version>
</dependency>
转载请注明出处:容休博客 » java.lang.IllegalStateException: InjectionManagerFactory not found解决办法

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址