ejb-ref-name question?

H

harry

I have an EAR file containing several stateless session EJB's

1 EJB (say EJB1) uses methods on another EJB (EJB2)

Reading about "ejb-ref-name", apparently I have to have this set in my
ejb-jar.xml file for EJB1 to ref EJB2

Currently I do not have this set but can reference EJB2 no problem at all
using something like (forgive typos) -

EJB2Remote ejb2Home = (EJB2RemoteHome)
ServiceLocator.getInstance().getRemoteHome("EJB2", EJB2RemoteHome.class);
ejb2 = ejb2Home.create();

// service locator code
public EJBHome getRemoteHome(String name, Class homeClass) throws
NamingException
{
Object objref = context.lookup(name);
EJBHome home = (EJBHome) PortableRemoteObject.narrow(objref, homeClass);
return home;
}

The article also says to use "java:comp/env/ejb/EJB2" not just "EJB2"

So do I need "ejb-ref-name" set & should I be using "java:comp/env/ejb/"?

Just can't see the difference!

many thanks

harry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top