* NamingException will be thrown also.
* @author Kevin McAllister <kevin@centraview.com>
*/
public static Object getHomeObject(String homeClassName, String beanJndiName) throws CommunicationException, NamingException
{
EJBHomeCache homeCache = EJBHomeCache.getInstance();
Class homeClass = null;
Object homeObject = null;
try {
homeClass = Class.forName(homeClassName);
} catch (ClassNotFoundException e) {
logger.error("[getHomeObject] There are classpath/classloader issues. I can't do Class.forName(" + homeClassName + ");", e);
// This kinda sucks, because you are losing information.
// but for now it wasn't worthwhile for me to go through and make sure
// ClassNotFoundException was also handled in some way by all the calling
// classes.
throw new NamingException("ClassNotFoundException!");
}
homeObject = homeCache.getHome(homeClass);
if (homeObject == null) {
Object tmpObj = Settings.getInstance().getInitCtx().lookup(beanJndiName);
homeObject = PortableRemoteObject.narrow(tmpObj, homeClass);
homeCache.putHome(homeClass, homeObject);
}
return homeObject;
}