title: Jersey stopped working with InjectionManagerFactory not found
body: <p>I am receiving below error while running my Jersey API in Tomcat 8.5.11 which is causing my API to stop:</p>
  
  <blockquote>
    <p>HTTP Status 500 - Servlet.init() for servlet Jersey REST Service threw
    exception</p>
    
    <p>type Exception report</p>
    
    <p>message Servlet.init() for servlet Jersey REST Service threw exception</p>
    
    <p>description The server encountered an internal error that prevented it
    from fulfilling this request.</p>
    
    <p>exception</p>
    
    <p>javax.servlet.ServletException: Servlet.init() for servlet Jersey REST
    Service threw exception
      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>root cause</p>
    
    <p>java.lang.IllegalStateException: InjectionManagerFactory not found.
      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>
  </blockquote>
  
  <p>The application is build with the following dependencies with gradle:</p>
  
  <pre><code>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.+"
      ) }
  </code></pre>
  
  <p>This downloads <code>jersey-common-2.26-b04.jar</code> which contains the missing class under <code>/org/glassfish/jersey/internal/inject/InjectionManagerFactory</code>. The jar file is deployed into the Tomcat folder under <code>WEB-INF/lib</code></p>
  
  <p>What can be wrong here? The gradle script worked the last few month with the same Tomcat version.</p>