In Our application,we have only stateless session bean.Hence we r caching remote ejbobject.
So the code for it is as follows :
public EJBHome getHome(String jndiHomeName, Class className) throws Exception
{
EJBHome home = null;
try{
Context initialContext = null;
Object objref = null;
try
{
initialContext = new InitialContext(System.getProperties());
objref = initialContext.lookup(jndiHomeName);
}
catch(Exception localExcep)
{
//code for exception
}
home = (EJBHome)PortableRemoteObject.narrow(objref, className);
}
catch (NamingException ne)
{
throw new MyOnstarSystemException(ne);
}
catch (Exception e)
{
throw new MyOnstarSystemException(e);
}
return home;
}
The problem is, above method returns EJBHome and not specific bean home.So i cant call create() on EJBHome.I need to have specific home say, AdminHome.
So how can I get specific home in generic way !!!
1 solution is, according to jndiHomename passed as method parameter, i create specific home object.
Pls let me know if there is any other solution.
Thanks.