I have an EAR which has a WAr and an EJB JAR. EJB jar has 2 ejbs in it one is the business
delegate and another is session facade actually. A web page looks up the business delegate
and invokes a method. Delegate method in turn tries to look up another EJB ( session
facade ) and cast it to the Remote interface. It gets a class cast exception while
casting. I have the ejbClient jar at the EAR level and its nowhere being used twice. I
even tried to print the implemented interfaces out of the object which ejbHome creates and
I see the remote interface being implemented by the object, even though I get classcast.
Here is the code in BusinessDelegate which invokes session facade :
public boolean manageMerchant( org.apache.struts.action.ActionForm merchantForm, int
actionType )throws Exception
{
// TODO Auto-generated method stub
HVAdminSessionFacadeHome home = ( HVAdminSessionFacadeHome )
ServiceLocator.getInstance().getHome("ejb/HVAdminSessionFacade",
com.hv.interfaces.HVAdminSessionFacadeHome.class);
Object objref = home.create();
System.out.println(objref.getClass().getName());
Class[] interfaces = objref.getClass().getInterfaces();
for (int i = 0; i < interfaces.length; ++i) {
//This prints out HVAdminSessionFacade
System.out.println(interfaces.getName() );
}
try{
//ClassCast happens here
HVAdminSessionFacade adminFacade = ( HVAdminSessionFacade) objref;
adminFacade.manageMerchant( merchantForm, actionType);
}catch ( Exception ex )
{
ex.printStackTrace();
}
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974241#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...