Jersey Injection Facade

In version 2.26 Jersey started to make their codebase independent of any injection framework. This means that the user has to provide the injection framework, which should be used. The h2k injection framework is completely supported, other frameworks as CDI or guice will follow.

Therefore it could be that you run into the following issue if you try to run your application:

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) 
...

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) 

To solve that issue you can add the injection framework by using the following snippet in Gradle:

    compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.28'
    // Starting 2.26 Jersey defines it's own injection facade and 
    // we need to provide an implementation for injectionManagerFactory
    compile 'org.glassfish.jersey.inject:jersey-hk2:2.28'

Take a look into the Release Notes to get more detailed information.

chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.