local Referance tag in Sun one server
Hi All,
In my ejb-jar.xml file have one ejb in that i have local Ejb. How i can spacify in the sun-ejb-jar.xml.when i trying to lookup the local ejb i got name not found exception .where as jboss we have one tag i.e. <local-jndi-name>
like wise we have any tag for refer the local ejb in sun-ejb-jar.xml.
plz help me .
Thank u.
# 1
jndi names are not required if you are accessing a local bean in the same app.
Use the ejb-link element instead.
<ejb-local-ref>
<ejb-ref-name>ejb/Sful</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.sun.s1asdev.ejb.perf.local.SfulHome</local-home>
<local>com.sun.s1asdev.ejb.perf.local.Sful</local>
<ejb-link>SfulBean</ejb-link>
</ejb-local-ref>
# 2
<ejb-local-ref>
<ejb-ref-name>ParametrosObjHomeLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>
com.deceval.siidj.siidserver.ParametrosObjLocalHome
</local-home>
<local>
com.deceval.siidj.siidserver.ParametrosObjLocal
</local>
<ejb-link>ParametrosObjHome</ejb-link>
</ejb-local-ref>
ejb-jar.xml
after that lookup of this local ejb is
public ParametrosObjLocal getParametroLocalSO() {
ParametrosObjLocal local = null;
try {
Context ctx = new InitialContext();
Object o = ctx.lookup("java:comp/env/ParametrosObjHomeLocal");
//ParametrosObjLocalHome o = (ParametrosObjLocalHome)ctx.lookup("java:comp/env/ParametrosObjHomeLocal");
ParametrosObjLocalHome helloHome = (ParametrosObjLocalHome) PortableRemoteObject
.narrow(o, ParametrosObjLocalHome.class);
local = (ParametrosObjLocal) helloHome.create();
} catch (NamingException e) {
//mLog.error("NamingException: " + e.getMessage());
e.printStackTrace();
mLog.info("Changeing the Lookup ");
throw new GenericException(e);
} catch (CreateException e) {
e.printStackTrace();
mLog.error("FinderException: " + e.getMessage());
throw new GenericException(e);
}
return local;
}
we should lookup the java:comp/env/ejbname