JBoss AS – Quick start in 5 minutes

JBoss AS is an open-source market-leader Java EE-based application server which enables the development and deploying of enterprise Java applications, Web applications and Portals.

There is exhaustive documentation at JBoss.com (JBoss AS web site and Product Datasheet to start with).

This post instead attempts to generate a five minutes “ready-steady-go” checklist with the basic steps to setup and use JBoss (*) for your development. Hopefully it can save you some time in the initial starting-up process. Good luck.

Install JBoss

  • Download the package from JBoss Download Center and unzip it.
  • Execute $JBOSS$/bin/run.bat

Understanding JBoss Directory Structure

JBoss top-level directory structure

  • bin: scripts
  • client: jars required by clients running outside JBoss
  • server: JBoss Server configuration (see below)
  • lib: JBoss Jar files (Do not place your own libraries in this directory).

JBoss server configuration

JBoss comes with 3 configuration sets:

  1. minimal: minimum services required to start JBoss (no web container).
  2. default: standard services needed by most J2EE applications. This is (obviously) the default configuration loaded by JBoss and the one typically used for web development.
  3. all: all available services.

To create a new configuration copy the default file set into a new directory and then modify the configuration files as desired.

Deployment on JBoss

JAR File Deployment

Deploy the JAR files (e.g log4j, DB drivers) required by the applications into $JBOSS$/server/default/lib

Property Files

Deploy the property files required by the applications and libraries into $JBOSS$/server/default/conf

WAR File Deployment

Deploy the WAR files into $JBOSS$/server/default/deploy

By default JBoss supports hot deployment of WAR files.

EAR File Deployment

Deploy the EAR files into $JBOSS$/server/default/deploy

Configure JDBC data source (for PostgreSQL)

Create into $JBOSS$/server/default/deploy a file called postgresql-ds.xml

Add into the xml file an entry for each connection:

<local-tx-datasource>
<jndi-name>java:alias</jndi-name>
<connection-url>jdbc:postgresql://localhost</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>username</user-name>
<password>password</password>
<!–pooling parameters–>
<min-pool-size>3</min-pool-size>
<max-pool-size>5</max-pool-size>
</local-tx-datasource>

Deploy PostgreSQL JDBC Drive into $JBOSS$/server/default/lib

Other databases can be configured similarly (e.g. oracle-ds.xml).

Define System Properties

Add new properties into $JBOSS$/server/default/deploy/properties-services.xml

Serving Static Content

The default context is the ROOT.war application which is under the deploy/jboss-web.deployer. Within this folder JBoss serves the static resources (html, images, etc..).
If you want to have a shared image folder just create a subfolder (e.g. img) in ROOT.war and place the images there.

Then access the “logo.gif” image at http://localhost:8080/img/logo.gif

* Based on JBoss 4.2.0.GA

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: