users@glassfish.java.net

EJB from Entity class

From: <glassfish_at_javadesktop.org>
Date: Thu, 28 Aug 2008 07:40:34 PDT

Hi I'm struggling to call a local EJB from an Entity class.

I use the NetBeans standard call enterprise bean functionality and get a lookup method that looks like this:

 private XFacadeLocal lookupXFacade() {
        try {
            Context c = new InitialContext();
            return (XFacadeLocal) c.lookup("java:comp/env/XFacade");
        } catch (NamingException ne) {
            java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

When calling the method I get:

No object bound to name java:comp/env/XFacade at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:834) at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)

So I guess I have to create a JNDI name somewhere to make this work...???
Any help on how to do this or other suggestions on what is wrong is appreciated.
I would think that this kind of functionality should work out of the box for NB.
I'm using NetBeans version 6.0.1 btw
[Message sent by forum member 'slingblade' (slingblade)]

http://forums.java.net/jive/thread.jspa?messageID=295933