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.

Bug 134984 - lookup EJB generated code doesn't work
Summary: lookup EJB generated code doesn't work
Status: RESOLVED WORKSFORME
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrey Yamkovoy
URL:
Keywords:
: 119073 124542 139081 145935 146293 (view as bug list)
Depends on: 143603
Blocks:
  Show dependency tree
 
Reported: 2008-05-13 18:48 UTC by jrcampins
Modified: 2009-09-16 11:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jrcampins 2008-05-13 18:48:30 UTC
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
Comment 1 jrcampins 2008-05-22 14:44:37 UTC
no news is good news?
Comment 2 pslechta 2008-07-07 10:43:17 UTC
*** Issue 139081 has been marked as a duplicate of this issue. ***
Comment 3 pslechta 2008-09-04 21:31:57 UTC
*** Issue 119073 has been marked as a duplicate of this issue. ***
Comment 4 pslechta 2008-09-08 10:30:32 UTC
*** Issue 146293 has been marked as a duplicate of this issue. ***
Comment 5 pslechta 2008-09-08 10:34:18 UTC
*** Issue 145935 has been marked as a duplicate of this issue. ***
Comment 6 pslechta 2008-09-08 10:44:34 UTC
*** Issue 124542 has been marked as a duplicate of this issue. ***
Comment 7 Andrey Yamkovoy 2009-09-16 11:30:18 UTC
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.