HelloWorld----------
public interface HelloWorld extends EJBObject {
public String getHello() throws java.rmi.RemoteException;
}
HelloWorldHome-------
public interface HelloWorldHome extends EJBHome{
HelloWorld create() throws CreateException, RemoteException;
}
HelloWorldImpl-------
public class HelloWorldImpl implements SessionBean{
private static final long serialVersionUID = 3159210541480135603L;
public String getHello() throws EJBException, RemoteException {
System.out.println("getHello()");
return "hello,world";
}
public void ejbActivate() throws EJBException, RemoteException {
}
public void ejbPassivate() throws EJBException, RemoteException {
}
public void ejbRemove() throws EJBException, RemoteException {
}
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
}
public void ejbCreate() throws javax.ejb.CreateException{};
}
ejb-jar.xml----
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>First</display-name>
<enterprise-beans>
<session>
<ejb-name>FirstEjb</ejb-name>
<home>com.ejb.HelloWorldHome</home><!--主接口-->
<remote>com.ejb.HelloWorld</remote><!--组件接口-->
<ejb-class>com.ejb.HelloWorldImpl</ejb-class><!--组件接口的实现-->
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
weblogic-ejb-jar.xml-------
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name >FirstEjb</ejb-name>
<stateless-session-descriptor>
<pool>
</pool>
<stateless-clustering>
</stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<jndi-name >FirstEjb</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
public interface HelloWorld extends EJBObject {
public String getHello() throws java.rmi.RemoteException;
}
HelloWorldHome-------
public interface HelloWorldHome extends EJBHome{
HelloWorld create() throws CreateException, RemoteException;
}
HelloWorldImpl-------
public class HelloWorldImpl implements SessionBean{
private static final long serialVersionUID = 3159210541480135603L;
public String getHello() throws EJBException, RemoteException {
System.out.println("getHello()");
return "hello,world";
}
public void ejbActivate() throws EJBException, RemoteException {
}
public void ejbPassivate() throws EJBException, RemoteException {
}
public void ejbRemove() throws EJBException, RemoteException {
}
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
}
public void ejbCreate() throws javax.ejb.CreateException{};
}
ejb-jar.xml----
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>First</display-name>
<enterprise-beans>
<session>
<ejb-name>FirstEjb</ejb-name>
<home>com.ejb.HelloWorldHome</home><!--主接口-->
<remote>com.ejb.HelloWorld</remote><!--组件接口-->
<ejb-class>com.ejb.HelloWorldImpl</ejb-class><!--组件接口的实现-->
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
weblogic-ejb-jar.xml-------
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name >FirstEjb</ejb-name>
<stateless-session-descriptor>
<pool>
</pool>
<stateless-clustering>
</stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<jndi-name >FirstEjb</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>