JBoss Frequently Asked Questions (FAQ)

18-749: Fault-Tolerant Distributed Systems




The following questions deal with JBoss, the EJB implementation recommended for this course. The examples refer to JBoss version 3.2.3 running on Linux and installed in /afs/ece/class/ece749/ejb/. Similar instructions apply on other platforms. More information on JBoss is available on The official JBoss website

1. What is JBoss?

JBoss is an open source application server implemetation for EJBs. It is the recommended EJB implementation for this course.
The latest version of JBoss is 4.0. However, we have verion 3.2.3 installed on the asl/game cluster machines since that is a more stable version, there is a lot of information available about working with that version and the version was used for this class last year as well and the students had very little problems with it.


2. Which should I use, JBoss or the J2EE Reference Implementation (or something else)?

This is a personal choice and depends on your level of experience with the products. However, we recommend using JBoss. It would appear to be used in production environments more frequently and has a more active user base. It is also easier to install on the game/asl lab machines. The J2EE reference implementation is not intended for production use (and, based on anecdotal evidence, seems to put a larger load onthe machines). The more recent versions of JBoss also have Eclipse integration through JBoss-IDE.

The JBoss binaries (and source) are available for free download at http://www.jboss.org/downloads.

There is a summary of free and open source tools for EJB here.

Also, we do not support a common installation of the J2EE reference implementation application server for this class. However, you can download it for linux, windows, or solaris from http://java.sun.com/j2ee/1.4/download.html#sdk. If the linux version fails to install because it thinks that your JRE is invalid, see http://forum.java.sun.com/thread.jsp?forum=136&thread=468069&message=2190181 and then set your LD_LIBRARY_PATH to include the extracted package directory.


3.a) How can I install JBoss? Is there a cluster installation of JBoss that I can use for this class ?

A cached copy of JBoss 3.2.3 binary distribution is available at /afs/ece/class/ece749/ejb/jboss-3.2.3.tgz. To install, you just need to unzip this folder in the desired location.
As mentioned above, we have JBoss installed for this class in /afs/ece/class/ece846/java/jboss-3.2.3.The general problem is that each team that decides to use this installation of JBoss will need its own deployment/server directory created in a location that is not writeable by the class.
Since JBoss is very easy to install, you have two options: (1) you can install JBoss in your own directory, or (2) you can contact the TA's (Soila Pertet and Joseph Slember) and they will set up a server instance in the ece749 JBoss installation for you that points to one of your own directories. If you choose option (2) you will still be able to start,stop, and configure your own instance directories, but you will not have full control of the JBoss distribution. However, option (2) will save you approximately 50M of disk space (and may ease some aspects of administration).


3.b) What are the steps I need to follow to use the cluster JBoss installation?

If you would like to use the cluster installation of JBoss, here is what you do:

We will then create a symlink from the jboss directory for you and you should be all set to use the cluster jboss installation.

Remember, you need to start JBoss with the -c option to tell it which directory to deploy beans out of.
     $JBOSS_HOME/bin/run.sh -c teamX
(where teamX is the directory you created in the first step above.)


4. How can I get started with EJB and JBoss quickly?

The best way to get started is to go through a tutorial targeted at the application server you intend to use. For JBoss, there are two tutorials that we suggest, which are well explained and comprehensive: JBoss which is from the JBoss website, and the O'Reilly JBoss Workbook.

The following gives a step-by-step description of how to run a simple EJB example on the cluster machines. We use the O'Reilly JBoss Workbook example for this purpose. A cached copy of the workbook and examples is available at /afs/ece/class/ece749/ejb/ejbwJboss.Files.zip.
This link shows commands and output that was captured while working through example 4.1 of the workbook.

NOTE: I am using asl.lab.ece.cmu.local and the bash shell for demonstration puposes. Similar instructions apply for other shells and machines.
Also, I am using the cluster installation of JBoss. You can use a separate installation by unzipping the JBoss binary in your workspace.

The next example in the workbook, ex04_2, deals with an entity and a session bean. Follow the instructions above to run that example as well.


5. How can I start using JBoss quickly?

Here are some JBoss Quick Start Guides:


6. What is JNDI?

JNDI = Java Naming and Directory Service. Hence, it is an API for providing naming and directory functionality for programs wirtten in Java. It is similar to the CORBA Naming Service.
More information on JNDI is available on Sun's JNDI Tutorial. You can also look at the this link for more information on the JBoss implementation of the JNDI.


7. How can I start using the J2EE Reference implementation quickly?


8. What are other sources for information on EJBs?


9. Which version of the JDK are we using for the project?

We highly recommend that you stick to using JDK 1.4.2 on Linux for your software development, which is the default JDK installation on the cluster machines.


10. Is there IDE integration for JBoss?

Yes. JBoss has full Eclipse integration for development.See JBoss-IDE.


11. Is there an easy way to run multiple instances of JBoss on the same machine yet not have the port numbers conflict?

You should use the BindingService. Read the following instructions, or click here for more information.

Preliminaries: My JBOSS_HOME variable is set to /afs/ece.cmu.edu/class/ece749/ejb/jboss-3.2.3/

There is a file called${JBOSS_HOME}/docs/examples/binding-manager/sample-bindings.xml.This file specifies a number of jboss port configurations such as ports-default, ports-01, and ports-02. Please note, however, that the number of port configurations is less than the number of groups in the class using the installed version of jboss. Therefore, you should create your own configuration, following the conventions (increment the second digit of each port number in the configuration, i.e., ports-default specifies port 8080 for the web server, ports-01 specifies 8180, and ports-02 specifies 8280).  You must update the value of each of the ports in the configuration, not just port 8080.

 

To use a port configuration from sample-bindings.xml, you must make a few modifications to the file ${JBOSS_HOME}/server/<your-server>/conf/jboss-service.xml.  Find the section of the file that looks like the XML code below.  Note that <!-- is an open comment character in XML, and --> is the close comment character.  Therefore, notice that this section is currently entirely commented out.  Instead, you want only the textual description to be commented out.  Once the XML code is uncommented, you should specify the port configuration that you want to use.  By default, once this code is uncommented, the system will use the ports-01 configuration.  Instead, choose the port configuration that you want from your modified sample-bindings.xml file.

 

   <!--

      | Binding service manager for port/host mapping. This is a sample

      | config that demonstrates a JBoss instances with a server name 'jboss1'

      | loading its bindings from an XML file using the ServicesStoreFactory

      | implementation returned by the XMLServicesStoreFactory.

      |

      | ServerName: The unique name assigned to a JBoss server instance for

      | lookup purposes. This allows a single ServicesStore to handle mulitiple

      | JBoss servers.

      |

      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore

      | during initialization that specifies how to connect to the bindings store.

      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface

      | implementation to create to obtain the ServicesStore instance.

 

   <mbean code="org.jboss.services.binding.ServiceBindingManager"

     name="jboss.system:service=ServiceBindingManager">

     <attribute name="ServerName">ports-01</attribute>

     <attribute name="StoreURL">../docs/examples/binding-manager/sample-bindings.xml</attribute>

     <attribute name="StoreFactoryClassName">

       org.jboss.services.binding.XMLServicesStoreFactory

     </attribute>

   </mbean>

 

   -->

 


12. What is Enterprise JavaBeans Query Language? 1/26/04

It is used to define the abstract schema for an entity bean.


13. I have been reading the JBoss documentation and have come across the term XDoclet.What is the purpose of XDoclet?

Intuitively, for our purposes, XDoclet allows you to work with a single file (the EJB implementation) and manage the creation of other required EJB files via JavaDoc comments. Getting Started with JBoss states that EJB XDoclet tags can be used to generate EJB and vendor (JBoss, WebLogic, WebSphere, Orion) specific:


14. Why do I see JNDI names that begin with 'java:' in client access code? How does the system know which server to look for?

The examples in the O'Reilly workbook use a jndi.properties file for each example which specifies the server location.The classpath to the jndi.properties file is set in the ant script to include this properties file. More information (from Getting Started with JBoss):

In J2EE we have two types of clients; the web clientis a composition of servlets and JSPs, and other clients running outside of the application server. The separation is importantbecause web clients can take advantage of running inside theapplication server like accessing the local (java:) namespace of the JNDIserver or using local interfaces on EJBs.


15. Can an EJB get services from its container?

According to http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html#EJBContainer, an EJB can access its container in one of three ways: