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
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