Downloading
To get JBoss, go to www.jboss.org. JBoss is available there in two
flavors: the standard bundle, which includes Jetty for web pages and
servlets, and the Tomcat bundle, which includes (you guessed it)
Tomcat instead of Jetty.
As of this writing, JBoss 3.2.1 is the latest stable release.
Installation
To install JBoss, first unzip the distribution file to a directory of your
choice. A directory named JBoss-version should be created, and it
should contain the following directories:
bin -- scripts
client -- client jars
docs -- documentation
lib -- server jars
Server Configurations
JBoss comes with three server configurations:
Startup
To start JBoss:
Windows:
1. Open an MS-DOS Prompt or Command Prompt window.
2. cd %JBOSS_HOME%\bin
3. run [-c default|minimal|all]
Unix:
1. Open a shell.
2. cd $JBOSS_HOME/bin
3. ./run [-c default|minimal|all]
Windows:
o Open an MS-DOS Prompt or Command Prompt window.
o cd %JBOSS_HOME%\bin
o shutdown -S or shutdown --server=url
Unix:
o
o
o
Open a shell.
cd $JBOSS_HOME/bin
./shutdown -S or ./shutdown --server=url
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:
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. oracleds.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"?>
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connectionurl>jdbc:oracle:thin:@oracle.somewhere.com:1521:DB</connectionurl>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>dev</user-name>
<password>secret</password>
</local-tx-datasource>
</datasources>
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"
"http://www.jboss.org/j2ee/dtd/jboss.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>Processor</ejb-name>
<jndi-name>ejb/Processor</jndi-name>
</session>
<entity>
<ejb-name>Data</ejb-name>
<jndi-name>ejb/Data</jndi-name>
</entity>
</enterprise-beans>
</jboss>
Note that, unlike other J2EE servers, JBoss does not require generation
of stubs and skeletons. It handles EJB usage dynamically.
Clients
As mentioned above, JBoss does not require client stubs. You will need
to provide only the following to clients:
Windows:
1. Open an MS-DOS Prompt window or Command Prompt
windows.
2. cd (RotMachine install dir.)
3. ant deploy-server
Unix:
1. Open a shell.
2. cd (RotMachine install dir.)
3. ant deploy-server
Windows:
1. cd build\bin
2. run-client
Unix:
1. cd build/bin
2. ./run-client.sh