title: CDI - Injecting a SessionBean into a ServletContextListener triggered service
body: <p>I have a <code>ServletContextListener</code> implementation which calls some bean. I'm trying to inject a session bean into that bean, but the injected session bean always comes as <code>null</code>.</p>
  
  <p>Could it be that the <code>BeanManager</code> is not initiated yet during <code>ServletContextListener</code> execution? Is there a known limitation for CDI and listeners? Or am I missing something in my code?</p>
  
  <p>Here is the definition for the SessionBean I'm trying to inject - </p>
  
  <pre><code>@Stateless
  @Local(MetricStubSessionLocal.class)
  @Remote(MetricStubSessionRemote.class)
  public class MetricStubSessionBean implements MetricStubSessionLocal,
      MetricStubSessionRemote {
      ...
  }
  </code></pre>
  
  <p>And here is the Bean I'm trying to inject into - </p>
  
  <pre><code>public class MetricStubGeneratorJob implements IdpTimer {
  
      @Inject
      private MetricStubSession metricStubSession;
  
      private TimerStatus status;
  
      public MetricStubGeneratorJob() {
          super();
      }
  
      public MetricStubGeneratorJob(TimerStatus status) {
          this.status = status;
      }
      ...
  }
  </code></pre>
  
  <p>Thanks in advance!</p>