title: @EJB in JBoss 5.1.0 GA?
body: <p>I've been struggling for this for a while now. </p>
  
  <p>I'm trying to gear up for EJB 3.0. I'm using JBoss 5.1.0 GA as my application server. I started with very simple stateless session bean with local interface and a simple jsp-servlet client which invokes session bean method. All this while I've been trying to use <code>@EJB</code> annotation to inject session bean into the servlet class.</p>
  
  <pre><code>public class SampleServlet extends HttpServlet {
  
      @EJB
      private PersonLocal person;
  
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
          System.out.println("In servlet");       
          response.getWriter().write("Person Name : "+person.getName());
          System.out.println(person.getName());       
      }
  }
  </code></pre>
  
  <p>I'm using JBoss 5.1.0 GA with the <em>default</em> configuration. (I also tried with <em>all</em> configuration)</p>
  
  <p>However, I used to get a null reference to the session bean injection. After struggling for a day or so, I finally tried the ugly EJB 2.x JNDI lookup method instead of <code>@EJB</code> annotation with configuration for jndi specified in the <code>jndi.properties</code> file and it worked without any other changes!</p>
  
  <p>Now, I tried to find out in the JBoss docs whether JBoss 5.1.0 GA does or does not support the injection with <code>@EJB</code> annotation, but couldn't find a concrete answer. So can someone tell me whether it does? cause I would really prefer annotation over JNDI lookup (I mean, who will not?). Am i missing something..?</p>
  
  <p>Probably should have put this in the JBoss forums, but.. I'm addicted to this place ;-)</p>