title: How to use JNDI to obtain a new Stateful Session Bean, in EJB3?
body: <p>I'm trying to use JNDI to obtain a new Stateful Session Bean in a servlet (as a local variable).  My <code>doGet()</code> method has the following:</p>
  
  <pre><code>Bean bean = (Bean) new InitialContext().lookup("beanName");
  </code></pre>
  
  <p>I've tried including <code>java:comp/env</code> but all of my attempts have led to naming exceptions.</p>
  
  <p>I'm attempting to bind the bean in the <code>@Stateful</code> annotation, using various guesses like <code>@Stateful(name="beanName")</code> and <code>@Stateful(mappedName="beanName")</code></p>