views:

399

answers:

2

Hi,

I am learning EJB3 from last few days. I have many questions regarding EJB, application servers and deployment of EJB.

To start with, I have created one simple helloworld stateless session bean but I don't know how to deploy it on server. It has single bean class, bean interface and one servlet client. I have used eclipse to develop this project.
None of the books that I read gives step by step details about how to put EJB on server and how to access those beans.

I have JBoss 6 server and I also have JEE budle downloaded from sun website. Does this JEE bundle contains Glassfish server? or do I need to download it separately?
Can anyone please give me step by step details of how to put my bean and its client on server (JBoss or JEE)?

And why do we need to include bean interface class in EJB client code? I mean either we need to keep client and bean in same package or if we keep them in seperate packages we need to import bean interfaces in client code. Am I right?

Thanks and Regards, Chandrashekhar

+1  A: 

You need to add GlassFish to your Eclipse installation (see GlassFish plugin for Eclipse).

The full process is described here (with the latest Eclipse Helios 3.6M6)

VonC
+2  A: 

With Java EE 6, you can package your Servlet and your EJB in a WAR (either package your EJB in a JAR and put it in WEB-INF/lib or simply put all classes in WEB-INF/classes). And to deploy this WAR, copy it to:

  • $GLASSFISH_HOME/domains/<domain1>/autodeploy for GlassFish v3*
  • $JBOSS_HOME/server/default/deploy for JBoss 6

With Java EE 5, you'll have to package your code in a EAR.

And if you want to deploy your application from Eclipse (using the Eclipse WTP), you'll have to install the appropriate server adapter. For Eclipse Galileo and GlassFish (there is currently no adapter for JBoss 6 AFAIK), right-click the server view, select New > Server, click on Download additional server adapters and select the GlassFish adapter. Finish to define your new GlassFish v3 Java EE 6 server and deploy your application on it (right-click on your application then Run As > Run on Server). For Eclipse Helios and GlassFish, you can follow the link given by @VonC (manual install) or check this answer (install via the Update Site).

Pascal Thivent
I didn't see your (much more complete) answer at the time. +1
VonC