Step1: Definition of Remote Interface
????????????? public interface Count extends EJBObject{
????????????????????????public int count() throws RomoteException;
????????????????????? }
Step2: Definition of Home Interface
???????????????public interface CountHome extends EJBHome {
????????????????????????Count create(int val) throws RemoteException, CreateException;
????????????????????? }
Step3: Definition of?Bean Class
???????????????Public class CountBean implements SessionBeam {
??????????????????????????public int val;
???????????????????????????public int count() {
??????????????????????????????System.out.println("count()");
????????????????????????????? return ++val;
??????????????????????????????}
?????????????? public void ejbCreate(int val) throws CreateException {
????????????????????????????this.val=val;
??????????????????????????? System.out.println("ejbCreate()");
???????????????????????? }
???????????????? public void ejbRemove(){};
???????????????? public void ejbActivate(){};
???????????????? public void ejbPassivate(){};
???????????????? public void setSessionContext(SessionContext ctx){};
????????? }
Step4: Definition of ejb-jar.xml
?????????????????? <ejb-jar>
????????????????????? <enterprise-beans>
??????????????????????? <session>
?????????????????????????? <ejb-name>Count</ejb-name>
??????????????????????????? <home>CountHome</home>
??????????????????????????? <remote>Count</remote>
??????????????????????????? <ejb-class>CountBean</ejb-class>
??????????????????????????? <session-type>Stateful</session-type>
??????????????????????????? <transaction-type>Container</transaction-type>
??????????????????????? </session>
????????????????????? </enterprise-beans>
????????????????????</ejb-jar>????????????????????
????????