In the home java file, there is two string
public static final String COMP_NAME="java:comp/env/ejb/Calc";
public static final String JNDI_NAME="jndi/CalcBean";
and if wanting to access this ejb from a jsp,then I should use jndi to
search the JNDI_NAME,then what is the functionality of COMP_NAME,and under
which condition should we use COMP_NAME instead of JNDI_NAME.
And from the CalcUtil java file we can find out COMP_NAME is used.but
when use the ejb from jsp by
Calc c=CalcUtil.getHome(h).create();
and run the file,it said that ejb not bound,And I guess JNDI_NAME should be
used to make it work,if this way, why not use JNID_NAME in file of
CalcUtil.java created by xdoclet?
public static com.CalcHome getHome() throws NamingException
{
InitialContext initialContext = new InitialContext();
try {
java.lang.Object objRef =
initialContext.lookup(com.CalcHome.COMP_NAME);
com.CalcHome home =
(com.CalcHome)PortableRemoteObject.narrow(objRef,
com.CalcHome.class);
return home;
} finally {
initialContext.close();
}
}
_________________________________________________________________
The new MSN 8 is here: Try it free* for 2 months
http://join.msn.com/?page=dept/dialup