title: Using EJB injection in a POJO
body: <p>I know that injection using the @EJB annotation is only possible in an EJB class, a servlet, or a JSF managed bean, but in the same time I need to have an instance of a some injected business interface in a POJO class, so I thought of doing the following:</p>
  
  <p>in my JSF managed bean</p>
  
  <pre><code>@EJB BusinessInterfaceLocal businessInterface;
  
  private void someMethod(){
      PojoInterface pojo = new PojoClass(this.businessInterface);
  }
  </code></pre>
  
  <p>and in my POJO class I have this constructor</p>
  
  <pre><code>BusinessInterfaceLocal businessInterface;    
  
  public PojoClass(BusinessInterfaceLocal businessInterface){
     this.businessInterface = businessInterface;
  
     //The following throws a Null Pointer Exception
     this.businessInterface.someMethodCall();
  }
  </code></pre>
  
  <p>Shouldn't the above work correctly? but it doesn't, the businessInterface object at the PojoClass is evaluated to null, and thus throwing a null pointer exception.</p>
  
  <p>I was hoping if anyone could point me out, on what I'm doing wrong.</p>
  
  <p>Thanks in advance.</p>