-
1. Re: call ejb from another ejb
mgao Aug 17, 2002 6:58 PM (in response to mgao)this is my code using one SessionBean on client call another SessionBean on server.
public class StaffManagementABean implements SessionBean {
private StaffManagementBHome staffManagementBHome = null;
private StaffManagementBHome getStaffManagementBHome() throws NamingException {
//looking up branchB's sessionbean home
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL, "localhost:1090");
Context initial = new InitialContext();
return (StaffMangementBHome) initial.lookup("StaffManagementB");
}
public void ejbCreate() throws CreateException {
try {
staffManagementBHome = getStaffManagementBHome();
} catch (Exception e) {
e.printStackTrace();
}//end catch
}//end ejbCreat
public void ejbActivate() {
try {
staffManagementBHome = getStaffManagementBHome();
} catch (NamingException e) {
}//end catch
}//end ejbActive
public void ejbPassivate() {
staffManagementBHome = null;
}
public void ejbRemove() {}
public void setSessionContext(SessionContext sc) {}
}
The StaffManagementB in server side container, and when I compiling, obviously, give me folowing error,
cannot resolve symbol class StaffManagementBHome