I develop enterprise project in NetBeans on GlassFish (J2EE_1.4). There are some entity beans, a couple of session beans and message driven bean in my project. I use entity beans from servlet (in same project, from web-component) in way like this:
InitialContext ic;
ic = new InitialContext();
UserLocalHome userHome = (UserLocalHome) ic.lookup("java:comp/env/ejb/User");
Everything works just fine. But when I try to do lookup from session bean or MDB I get naming error. No bean can lookup any other bean. There are some references in web deployment descriptors, but AFAIK there's no need to define references for EJB. Also all entity beans have only local interface.