March 2, 2021
Hot Topics:

Jumping Into JBoss

  • By Thornton Rose and David Thurmond
  • Send Email »
  • More Articles »


Jboss is managed with a web-based console. To access it, start your browser and go to "http://localhost:8080/jmx-console". To view or change the configuration for a particular service, simply click on the link to it.

Additionally, with the management console, you can invoke public methods of services. For example, to shutdown the server:

  • Open the management console.
  • Scroll down the page to the "jboss.system" section.
  • Click on the "type=Server" link.
  • Scroll down to "void shutdown()" section.
  • Click the "Invoke" button.

Deploying Applications

Deploying applications to JBoss could not be easier. Simply copy your application archive file -- .jar, .war, or .ear -- to the deploy directory of the server configuration that is running. JBoss will detect the file, extract the contents, and load the application.

Here is an example of deploying an application to the default server configuration:

  • Windows:

    copy rotmachine.ear %JBOSS_HOME%\server\default\deploy

  • Unix:

    cp rotmachine.ear $JBOSS_HOME/server/default/deploy

During deployment, JBoss logs messages to the console and log/server.log, which is located in the server configuration directory. If deployment is successful, you should see a message like this:

22:21:44,730 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.2.1/server/default/deploy/rotmachine.ear

Additionally, if you open the JBoss Management Console, you should see your application listed in the "jboss.j2ee" section.

Undeploying Applications

Undeploying applications is even easier than deploying them. To undeploy a application, delete the application archive file from the deploy directory. JBoss will notice that the file has been deleted and undeploy the application.

When undeploying an application, JBoss logs messages to the console and server.log. If undeployment is successful, you should see a message like this:

22:59:41,500 INFO [MainDeployer] Undeployed file:/C:/jboss-3.2.1/server/default/deploy/rotmachine.ear

Data Sources

If your application is going to connect to a database using JBoss, you will need to configure a data source for the database. Here is how to configure a basic data source:

  1. If the JDBC driver library for your database is not in lib directory of the server configuration you are using, copy it there, then restart JBoss.

  2. Create a data source descriptor for your database, e.g. oracle-ds.xml.

  3. Deploy the data source descriptor as you would deploy an application.

Here is an example of a descriptor for an Oracle data source:

   <?xml version="1.0" encoding="UTF-8"?>

Additional examples of data source descriptors can be found in JBOSS_HOME/docs/examples/jca.

Enterprise JavaBeans (EJBs)

EJBs are constructed for JBoss like they would be constructed for any other J2EE application server, with the addition of a JBoss EJB deployment descriptor, jboss.xml. Here is an example:

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN"


Note that, unlike other J2EE servers, JBoss does not require generation of stubs and skeletons. It handles EJB usage dynamically.


As mentioned above, JBoss does not require client stubs. You will need to provide only the following to clients:

  • The EJB home and remote.
  • Any classes that are passed between the client and the EJB.
  • A copy of JBOSS_HOME/client/jbossall-client.jar.

Here is an example of connecting to an EJB deployed in JBoss:

   // Create env.
   Hashtable env = new Hashtable();

   // Create naming context.
   InitialContext context = new InitialContext(env);

   // Find home.
   CipherHome home = (CipherHome) context.lookup("ejb/org/rotmachine/Cipher");

   // Create remote.
   Cipher cipher = home.create();

Page 2 of 3

This article was originally published on September 3, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

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