wood burning stoves 2.0*
The moose likes BEA/Weblogic and the fly likes how to deploye EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "how to deploye EJB " Watch "how to deploye EJB " New topic
Author

how to deploye EJB

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
hi all I am new to ejb. I have weblogic 6.1.

I have created a simple example ejb bt not able to fine how to deplyed it.

Home interface

//Calc.java
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface Calc extends EJBObject{
public double calcBonus(int multiplier,double bonus) throws RemoteException;
}
//CalcBeanJava
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class CalcBean implements SessionBean{

public double calcBouns(int multiplier,double bonus){
double calc=(multiplier*bonus);
return calc;
}
public void ejbCreate(){}
public void setSessionContext(SessionContext ctx){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
}
// CalcHome Interface
importjava.rmi.RemoteException;
importjavax.ejb.CreateException;
importjavax.ejb.EJBHome;
public interface CalcHome extends EJBHome{
Calc create() throws CreateException,RemoteException;
}
// servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;

public class BonusServlet extends HttpServlet{
CalcHome homecalc;
Calc theCalculation;
public void init(ServletConfig config) throws ServletException{
try{
InitialContext ctx=new InitialContext();
Object objref=ctx.lookup("calcs");
homecalc=(CalcHome)PortableRemoteObject.narrow(objref,CalcHome.class);
}catch(Exception NamingException){NamingException.printStackTrace();}
}// end of init

public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException {
String socsec=null;
int multiplier=0;
double calc=0.0;
PrintWriter out;
response.setContentType("text/html");
String title="EJB Example";
out=response.getWriter();
out.println("<html><head><title>");
out.println(title);
out.println("</title></head><body>");
try{
String strMult=request.getParameter("MULTIPLIER");
Integer integerMult=new Integer(strMult);
multiplier=integerMult.intValue();
socsec=request.getParameter("SOCSEC");
double bonus=100.00;
theCalculation=homecalc.create();
calc=theCalculation.calcBonus(multiplier,bonus);
}catch(Exception CreateException){
CreateException.printStackTrace();
}

out.println("<h1>Bonus calculation</h1>");
out.println("<p>Soc Sec:"+socsec+"</p>");
out.println("<p>Multiplier:"+multiplier+"</p>");
out.println("<p>Bouns Amount:"+calc+"</p>");
out.println("</body></HTML>");
}

}
//********************************************************************
I HAVE COMPLIED ALL THE FILE USING WEBLOGIC.JAR
NOW plz suggest me way to deploy it..

thanx
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
Well, Can we assume that you have created the required deployment descriptor files

ejb-jar.xml
weblogic-ejb-jar.xml
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to deploye EJB
 
Similar Threads
About BMP Entity Bean problem
Help with CalcHome.java interface
Help with CalcHome.java interface
Error with BMP Entity Bean
unable to recognize jndi name when using myeclipse3.8.3