EJBObjectjava.rmi.RemoteExceptionpublic interface MyEJB extends EJBObject {
String sayHello() throws RemoteException;
}
EJBHomecreate() 方法RemoteException 與 CreateExceptionpublic interface MyEJBHome extends EJBHome {
MyEJB create() throws RemoteException, CreateException;
}
SessionBean 介面implements MyEJB 直接實作遠端介面ejbCreate() + 商業方法public class MyEJBClass implements SessionBean {
public void ejbCreate() throws RemoteException, CreateException {}
public void ejbActivate() throws RemoteException {}
public void ejbPassivate() throws RemoteException {}
public void ejbRemove() throws RemoteException {}
public void setSessionContext(SessionContext ctx) throws RemoteException {}
public String sayHello() { System.out.println("Hello"); }
}
需提供資訊:
EJB 1.1 規範採用 XML 格式 (ejb-jar.xml) 並提供 DTD。
create() 參數/個數需與 ejbCreate() 對應