users@glassfish.java.net

Locating an EJB in a class called by an EJB

From: <glassfish_at_javadesktop.org>
Date: Wed, 30 May 2007 15:37:49 PDT

I have a Session Bean that calls some business logic that's implemented in a seperate class.

I wanted the business logic class to be able to find a Session Bean and call methods upon it.

I tried using the generic, generated lookup method the NetBeans will created for you, but I was always getting a NamingException complaining it couldn't find the Session Bean.

The generic NB lookup code uses and EJB Reference, which is normally used from the Web tier, and NB then updates the appropriate XML files to note the EJB reference.

So, I tried changing the name from the EJB reference name to the name of the interface class. But I still get the NamingException.

What I've done for now is I'm using the @EJB annotation to inject the beans in to my parent SSB, and then inject the references directly to be used by my business logic.

But I'm curious as to why the class was unable to locate the beans I was looking for in the first place.
[Message sent by forum member 'whartung' (whartung)]

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