Hello Punit,
Hope you have read the right theory for EJB's. Because they do confuse you a lot.
EJB's over the years has become from a developer nightmare to developer friendly (from version 1 to version 3). The version that is widely being used is EJB 3.0
EJB3.0 is more like a POJO with a few annotations. all you have to do is follow these steps.
1. Create an interface with your own name and mark it as @remote
import javax.ejb.Remote;
@Remote
public interface FirstEJBRemote {
public int addTheseTwoNumbers(int a, int b);
}
2. import javax.ejb.Stateless;
/**
* Session Bean implementation class FirstEJB
*/
@Stateless
public class FirstEJB implements FirstEJBRemote {
/**
* Default constructor.
*/
public FirstEJB() {
// TODO Auto-generated constructor stub
}
public int addTheseTwoNumbers(int a, int b){
System.out.println("The two numbers are a = "+ a +" b = "+ b);
return a+b;
}
}
Thats it we are done coding a Session Bean. All you have to do is get yourself an application server(
JBOSS, Websphere, Weblogic, glassfish etc.) , package it and deploy. It's that simple.
You just dont need any XML's at all.
Hope this helps.
Do let me know if you need details on how to delpoy them.
Thanks and regards
Raghav.V