You need the netbeans, jdk and the sun app server installed and configured. Sun app server must be added to the list of servers in Netbeans. This can be done through the "Tools-> Server Manager" in the Netbeans menu.
After Configuring all those stuff, please try out the following procedure for creating the EJB's.
This procedure is for those who dont have JAVA EE 5 support. Its for j2ee 1.4 only.
1)First select "new project" from the file menuin netbeans.
Within the "Choose project" Dialog Box, Select Enterprise under Categories and "Enterprise Application" under Projects and click on Next button.
2)In the "Name and Location" DialogBox, Enter the name of the Project and select the Location. Make sure that "create EJB module" and "create Web Application Module" checkboxes are selected. Make sure that the JAVA EE version is "j2ee 1.4".
3)Netbeans automatically creates the Project files. Then right click in the "Enterprise Beans" within the "-ejb" part and select "New-> Session Bean".
4)In the "Name and Location" Dialog box that follows, enter the EJB name and the package name. Select Session type as Stateless. Select only Remote within the "Create interface" option.
5)It can be seen that the Bean's Bean, Remote, RemoteBussiness and RemoteHome classes are automatically generated.
6)Then edit the Remote Interface class to include the declaration of the function that you want.
public String sayHello() throws java.rmi.RemoteException;
7)In the corresponding bean class, implement the corresponding method declared in the Remote Interface.
8)Then right click on "Source Packages" within the "-war" part and select "New-> servlet".
9)In the Name and Location Dialog Box that follows, Enter the name of the servlet and the package for the servlet and click on "Next".
Then in the Next window, click "Finish" button.
10)Then right click within the code area of the generated servlet class file and select "Enterprise resources->Call Enterprise Bean".
11)Then a Dialog box comes up with the list of all the ejb's open in the current project. In that, select the Bean you created and click on ok.
12)It can be seen that netbeans automatically adds the following function to the servlet code.
private StatelessSessionRemote lookupStatelessSessionBean()
13)Now add the following line to the processRequest function after the PrintWriter creation line.
14)Now save all the codes and right click on the project and select "Build Project". NetBeans builds and links the project.Then right click on the project and select "Run Project". Netbeans runs the project and creates the browser page on completion.Add the "/servletname" to the address tab and press enter. It can be seen that the EJB function is called and the output is displayed in the servlet.