title: Inject a EJB into a JSF converter with JEE6
body: <p>I have a stateless EJB that acceses my database. 
  I need this bean in a JSF 2 converter to retreive an entity object from the String value parameter. I'm using JEE6 with Glassfish V3.</p>
  
  <p><code>@EJB</code> annotation does not work and gets a NPE, because it's in the faces context and it has not access to the EJB context.</p>
  
  <p>My question is:
  Is it still possible to Inject this bean with a <code>@Resource</code> or other annotation, or a JNDI lookup, or do I need a workaround? </p>
  
  <hr>
  
  <p><strong>Solution</strong></p>
  
  <p>Do a JNDI lookup like this:</p>
  
  <pre><code>  try {
     ic = new InitialContext();
     myejb= (MyEJB) ic
       .lookup("java:global/xxxx/MyEJB");   
    } catch (NamingException e) {
     e.printStackTrace();
    }
  </code></pre>