This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have created an Enterprise Application project using NetBeans. The project contains several EJB modules, J2SE libraries, Web Applications, etc. In one of the EJB modules I have a Session Bean which I need to access from other EJB modules. To do it from another Session Bean I use the @EJB annotation and I have no problems at all. But I also would like to access it from a standard java class. The code generated by NetBeans doesn’t work (generated by right click + “Enterprise Resources” + “Call Enterprise Bean”). This is the code: private UsuarioFacadeLocal lookupUsuarioFacade() { try { Context c = new InitialContext(); return (UsuarioFacadeLocal) c.lookup("java:comp/env/UsuarioFacade"); } catch (NamingException ne) { java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } } It cannot find the EJB. At the Glassfish log I can see the corresponding exception stack trace with the message: javax.naming.NameNotFoundException: java:comp/env/UsuarioFacade not found. I have reported a very similar problem trying to find a DataSource. Please see issue #134983
no news is good news?
*** Issue 139081 has been marked as a duplicate of this issue. ***
*** Issue 119073 has been marked as a duplicate of this issue. ***
*** Issue 146293 has been marked as a duplicate of this issue. ***
*** Issue 145935 has been marked as a duplicate of this issue. ***
*** Issue 124542 has been marked as a duplicate of this issue. ***
Tried with Enterprise App which contains EJB and Web modules (EE5) deployed on Glassfish v3. The code generated by NB in the standard java class (located in the Web module) the same as reported by submitter and it works. Probably it was a Glassfish v2 issue. So closing as worksforme because the code generated by NB is working.