title: Guice nullpointer exception on injected instance
body: <p>I'm using Guice in Jersey2 for DI (i want to use it so i can use Google App Engine -> not working with HK2).</p>
  
  <p>My ApplicationResource:</p>
  
  <pre><code>public class ApplicationResource extends ResourceConfig {
  
      private static final Logger LOGGER = null;
  
      public ApplicationResource() {
          System.out.println("Application startup");
          // Register resources and providers using package-scanning.
          packages("com.crawler.c_api");
  
          // Register my custom provider - not needed if it's in my.package.
          register(ResponseCorsFilter.class);
  
          Injector createInjector = Guice.createInjector(new AbstractModule(){
  
              @Override
              protected void configure() {
                  bind(NLPProvider.class).toInstance(new NLPProvider());
              }
  
          });
  
  
          // Register an instance of LoggingFilter.
          register(new LoggingFilter(LOGGER, true));
  
          // Enable Tracing support.
          property(ServerProperties.TRACING, "ALL");        
  
          EncodingFilter.enableFor(this, GZipEncoder.class);
      }
  }
  </code></pre>
  
  <p>NLPProvider loads a bunch of files - and the files are loaded correctly.
  But when i try to inject the Instance of NLPProvider it stay null.</p>
  
  <p>CrwalerResource:</p>
  
  <pre><code>@Path("/crawler")
  public class CrawlerResource {
  
      @Inject
      NLPProvider pipeline;
  
      @GET
      @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
      public Response crawlUrl(@BeanParam CrawlerQueryParam queryParameters) {
          CrawlerService crawl = new CrawlerService();
          return Response.status(200).entity(crawl.extractFromUrl(queryParameters, pipeline)).build();
      }
  
  }
  </code></pre>
  
  <p>What am i doing wrong considering that i used HK2 before?</p>
  
  <hr>
  
  <p>My pom.xml - maybe the issue comes from here:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.crawler&lt;/groupId&gt;
      &lt;artifactId&gt;C_API&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;C_API&lt;/name&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;C_API&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.2&lt;/version&gt;
                  &lt;inherited&gt;true&lt;/inherited&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
                  &lt;version&gt;${jersey.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
              &lt;!-- use the following artifactId if you don't need servlet 2.x compatibility --&gt;
              &lt;!-- artifactId&gt;jersey-container-servlet&lt;/artifactId --&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.zaxxer&lt;/groupId&gt;
              &lt;artifactId&gt;HikariCP-java6&lt;/artifactId&gt;
              &lt;version&gt;2.2.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.36&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-codec&lt;/groupId&gt;
              &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
              &lt;version&gt;1.9&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;1.9.13&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mindrot&lt;/groupId&gt;
              &lt;artifactId&gt;jbcrypt&lt;/artifactId&gt;
              &lt;version&gt;0.3m&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.json-lib&lt;/groupId&gt;
              &lt;artifactId&gt;json-lib&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
              &lt;classifier&gt;jdk15&lt;/classifier&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.syncthemall&lt;/groupId&gt;
              &lt;artifactId&gt;boilerpipe&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;xerces&lt;/groupId&gt;
              &lt;artifactId&gt;xercesImpl&lt;/artifactId&gt;
              &lt;version&gt;2.11.0&lt;/version&gt;
          &lt;/dependency&gt; 
          &lt;dependency&gt;
              &lt;groupId&gt;net.sourceforge.nekohtml&lt;/groupId&gt;
              &lt;artifactId&gt;nekohtml&lt;/artifactId&gt;
              &lt;version&gt;1.9.22&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.opennlp&lt;/groupId&gt;
              &lt;artifactId&gt;opennlp-tools&lt;/artifactId&gt;
              &lt;version&gt;1.6.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
              &lt;artifactId&gt;guava&lt;/artifactId&gt;
              &lt;version&gt;14.0.1&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.github.mpkorstanje&lt;/groupId&gt;
              &lt;artifactId&gt;simmetrics&lt;/artifactId&gt;
              &lt;version&gt;3.2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.cybozu.labs&lt;/groupId&gt;
              &lt;artifactId&gt;langdetect&lt;/artifactId&gt;
              &lt;version&gt;1.1-20120112&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;!-- jsoup HTML parser library @ http://jsoup.org/ --&gt;
              &lt;groupId&gt;org.jsoup&lt;/groupId&gt;
              &lt;artifactId&gt;jsoup&lt;/artifactId&gt;
              &lt;version&gt;1.8.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.inject&lt;/groupId&gt;
              &lt;artifactId&gt;guice&lt;/artifactId&gt;
              &lt;version&gt;3.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
      &lt;/dependencies&gt;
      &lt;properties&gt;
          &lt;jersey.version&gt;2.21&lt;/jersey.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>