Hi JMS,
I do know what you mean clearly. I attach my Java FiboBean.java as the following. By this with XDoclet generation, Fibo.java and FiboHome.java were made automatically.
/*
* Created on 2004/4/10
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package tutorial.ejb;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
/**
* @author cs_cwt
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*
* @ejb.bean name = "Fibo"
* display-name = "Fibo EJB"
* description = "EJB that computes Fibonacci suite"
* view-type = "remote"
* jndi-name = "ejb/tutorial/Fibo"
*/
public class FiboBean implements SessionBean {
/**
*
*/
public FiboBean() {
super();
// TODO Auto-generated constructor stub
}
/**
* @author Teki Chan
* @name ejbCreate
*
* This method is without parameter as this EJB is stateless
*
* @throws CreateException
* @ejb.create-method
*/
public void ejbCreate()
throws CreateException {
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbRemove()
*/
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
*/
public void setSessionContext(SessionContext arg0)
throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
* @author Teki Chan
* @name compute
* @param number
* @return double[]
* @ejb.interface-method view-type = "remote"
*
* The business method of computing a Fibonacci suite
*/
public double[] compute(int number) {
if (number < 0) {
throw new EJBException("Argument should be positive");
}
double[] suite = new double[number+1];
suite[0] = 0;
if (number == 0) {
return suite;
}
suite[1] = 1;
for(int i=2; i<=number; i++) {
suite
= suite[i-1] + suite[i-2];
}
return suite;
}
}
while ejb-jar.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "
<ejb-jar >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session >
<description><![CDATA[EJB that computes Fibonacci suite]]></description>
<display-name>Fibo EJB</display-name>
<ejb-name>Fibo</ejb-name>
<home>tutorial.interfaces.FiboHome</home>
<remote>tutorial.interfaces.Fibo</remote>
<ejb-class>tutorial.ejb.FiboBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
Please help. Thanks.
-stan