我在Tomcat 8.5.11中运行我的Jersey API时收到以下错误,这导致我的API停止:
HTTP状态500 - servlet .init()为servlet Jersey REST服务抛出 除了< / p >
异常报告
消息servlet .init()为servlet Jersey REST服务抛出异常
description服务器遇到内部错误,无法执行此操作
异常
< p > javax.servlet。ServletException: servlet .init()用于servlet Jersey REST 服务抛出异常 org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java: 474) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 79) org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java: 624) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 349) org.apache.coyote.http11.Http11Processor.service (Http11Processor.java: 783) org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java: 66) org.apache.coyote.AbstractProtocol ConnectionHandler.process美元(AbstractProtocol.java: 798) org.apache.tomcat.util.net.NioEndpoint SocketProcessor.doRun美元(NioEndpoint.java: 1434) org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java: 49) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1142) java.util.concurrent.ThreadPoolExecutor Worker.run美元(ThreadPoolExecutor.java: 617) org.apache.tomcat.util.threads.TaskThread WrappingRunnable.run美元(TaskThread.java: 61) java.lang.Thread.run (Thread.java: 745) < / p >根本原因
< p > . lang。IllegalStateException: InjectionManagerFactory未找到。 org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory (Injections.java: 97) org.glassfish.jersey.internal.inject.Injections.createInjectionManager (Injections.java: 89) org.glassfish.jersey.server.ApplicationHandler。(ApplicationHandler.java: 282) org.glassfish.jersey.servlet.WebComponent。(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: 474) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 79) org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java: 624) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 349) org.apache.coyote.http11.Http11Processor.service (Http11Processor.java: 783) org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java: 66) org.apache.coyote.AbstractProtocol ConnectionHandler.process美元(AbstractProtocol.java: 798) org.apache.tomcat.util.net.NioEndpoint SocketProcessor.doRun美元(NioEndpoint.java: 1434) org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java: 49) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1142) java.util.concurrent.ThreadPoolExecutor Worker.run美元(ThreadPoolExecutor.java: 617) org.apache.tomcat.util.threads.TaskThread WrappingRunnable.run美元(TaskThread.java: 61) java.lang.Thread.run (Thread.java: 745) < / p >
该应用程序与gradle的依赖关系如下:
dependencies {
compile (
// REST
"org.glassfish.jersey.containers:jersey-container-servlet:2.+",
"javax.servlet:javax.servlet-api:4.+",
// REST Token
"org.bitbucket.b_c:jose4j:0.+",
// MongoDB
"org.hibernate.ogm:hibernate-ogm-bom:5.+",
"org.hibernate.ogm:hibernate-ogm-infinispan:5.+",
"org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.+",
"org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.+",
"org.jboss.narayana.jta:narayana-jta:5.+",
"org.jboss:jboss-transaction-spi:7.+",
"log4j:log4j:1.+",
"org.hibernate.ogm:hibernate-ogm-mongodb:5.+",
"org.bouncycastle:bcprov-jdk15on:1.+"
) }
这将下载jersey-common-2.26-b04.jar
,其中包含/org/glassfish/jersey/internal/inject/InjectionManagerFactory
下缺少的类。jar文件部署到WEB-INF/lib
下的Tomcat文件夹中
这有什么不对吗?过去几个月,gradle脚本在相同的Tomcat版本上运行。