title: EJB injection not working in different classes
body: <p>I have tried to inject an Entity EJB(Facade and entity from MySQL database) but it doesn't work depending on the class it is in. I use a Rest webService and it work in the webService class.
  I use a multi layered architecture and I don't want my EJB to be injected in this webService.</p>
  
  <p>So, this is the @Stateless facade :</p>
  
  <pre><code>public class ActivityEntityFacade extends AbstractFacade&lt;ActivityEntity&gt; {
  @PersistenceContext(unitName = "persistance")
  private EntityManager em;
  
  @Override
  protected EntityManager getEntityManager() {
      return em;
  }
  
  public ActivityEntityFacade() {
      super(ActivityEntity.class);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>this is the rest webService method working with EJB :</p>
  
  <pre><code>@EJB
  private ActivityEntityFacade activityfacade;
  
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/{date}")
  public List&lt;ActivityEntity&gt; activities(@PathParam("date") String date){
      List&lt;ActivityEntity&gt; activityList = activityfacade.findAll();
      return activityList;
  }
  </code></pre>
  
  <p>And this is my activityManager which is supposed to work with the EJB and supposed to return this List to another layer :</p>
  
  <pre><code>public class ActivityManager implements Serializable, IActivity {
  
  @EJB
  private ActivityEntityFacade activityfacade;
  
  public ActivityManager(){
  }
  
  public List&lt;ActivityEntity&gt; selectAll(){
      return  activityfacade.findAll();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This snipet return nullPointerException on the activityEntityFacade.
  Have you any idea why it doesn't work in this case ?</p>
  
  <p>EDIT:
  the instance of activityManager is created in the previous layer:</p>
  
  <pre><code> class ServActivityConsult implements IActivable{
  
  @Override
  public List&lt;ActivityEntity&gt; activityList() {
      IActivity managerActivity = new ActivityManager();
      return managerActivity.selectAll();
  }
  
  public ServActivityConsult(){
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But the error come from return  activityfacade.findAll IN ActivityManager in our case.</p>