使用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>
最新评论
我的是ipv4网络,如何使用直播源啊!
我今天试了,不想啊,我的是新疆昌吉移动的网络。
收不到验证码电报
现在充值29起了