Hi,
I am new to
EJB and I am not sure of the development process that has to be followed.
I recently installed weblogic8.1 and was able to create a
test domain for sample application.
I just thought of writing a small stateless bean.
Here is my code and xml files.
------
package agency;
import java.rmi.*;
import javax.ejb.*;
public interface AgencyHome extends EJBHome
{
Agency create() throws RemoteException, CreateException;
}
---
package agency;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface Agency extends EJBObject
{
String getAgencyName() throws RemoteException;
}
---
package agency;
import java.rmi.RemoteException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.ejb.*;
import java.util.*;
public class AgencyBean implements SessionBean
{
String name="";
private SessionContext cxt;
public String getAgencyName(){
return name;
}
public void ejbCreate() throws CreateException,NamingException{
InitialContext ic = new InitialContext();
name=(String) ic.lookup("java:comp/env/AgencyName");
}
public void ejbActivate(){
}
public void ejbRemove(){
}
public void ejbPassivate(){
}
public void setSessionContext(SessionContext cxt){
this.cxt = cxt;
}
};
---
<?xml version="1.0" encoding="UTF-8" ?>
<!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>
<enterprise-beans>
<session>
<ejb-name>Agency</ejb-name>
<home>agency.AgencyHome</home>
<remote>agency.Agency</remote>
<ejb-class>agency.AgencyBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<env-entry>
<env-entry-name>AgencyName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>Saritha</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
</ejb-jar>
---
<?xml version="1.0" encoding="UTF-8" ?>
<!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>Agency</ejb-name>
<jndi-name>Agency</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
----
I compiled by
java file.
Created a META-INF directory and placed .xml files in this directory.
Then i jared agency package with class files and META-INF dir into a Agency.jar file.
then i tried to generate skels and stubs using appc tool. This is the command which i have used.
java weblogic.appc Agency.jar
when I run this command, I am getting few warning and exceptions.
I am not sure where i went wrong.
Even I am sure if the process i have followed is correct or not.
What would be output of appc command.
Can anyone please detail me the whole process.
and provide me links where i can find info on this.
Thank you very much in advance.
Saritha