Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Get Started with JBoss Application Server-3 : Page 3


advertisement

Deployment Process
Ultimately, enterprise beans are packaged in a JAR file with the appropriate XML files in the META-INF folder. Most J2EE app servers require the deployment of an EJB JAR within a WAR file, and even within an EAR file. The process of packaging up an enterprise bean with deployment descriptors into a larger archive with its deployment descriptors can become rather complex. This process may be necessary in a production environment, but in development, you need quick, efficient deployment. JBoss provides the best of both worlds.

All you do to deploy EJBs in JBoss is drop the archive into the deploy directory. The JBoss engine immediately inspects the contents of the archive and attempts to deploy the bean(s). Undeploying is as easy as deleting the archive from the deploy directory.

Making the deployment process highly efficient are the following features:

  • JBoss supports the deployment of EJB JARs contained within WARs and EARs, but it also supports the native deployment of EJB JARs.
  • JBoss does not require the inclusion of the server-specific XML file unless you make specific changes.


Download this JAR file for a sample EJB application to test on your JBoss server.

Accessing a Bean
To access the deployed bean(s), take the following four steps:

  1. Write the client code.
  2. Set up JNDI environment settings for the client (best done via a JNDI properties file).
  3. Set up the classpath for the client and add the following file locations to it: jboss-client.jar, jnp-client.jar, EJB interfaces, and the directory where the JNDI properties file is stored (not the file itself, only the directory).
  4. Invoke the client.

Only the second step really needs to be discussed further. Two JNDI settings must be made, the initial context factory and the provider URL. These properties are best established in a JNDI properties file.

Once you have set up a jndi.properties file, you should place it in a directory and place that directory into the client's classpath (the file itself should not, only the directory where the property file is located).

That's it. You are ready to fire up the server, drop the JAR into the deploy directory, start the client, and invoke the EJB service.

Another Tool to Increase Productivity
The JBoss App server is a full-featured, J2EE app server with robust EJB support. It is the most popular and robust open-source EJB solution, and is packed with some interesting features that are bringing—and should continue to bring—attention to the software.

Downloading and installing JBoss should provide you with another tool to increase your productivity when developing J2EE and EJB. See you next month!



DevX Java Pro Kyle Gabhart is the director of the Java Technology Group for Objective Solutions, a Richardson, TX-based knowledge-transfer group specializing in Java technologies. He also serves as a senior mentor, trainer, and consultant for Objective Solutions, specializing in J2EE, XML, and Web Services technologies.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date