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.
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.
- Download the package from JBoss Download Center and unzip it.
- Execute $JBOSS$/bin/run.bat
- On your browser invoke http://localhost:8080
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:
- minimal: minimum services required to start JBoss (no web container).
- 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.
- 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
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:
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