What Is JBoss?
- A popular open source Java application server that supports the J2EE 1.3 specifications
- Runs under any J2SE 1.3 or later Java virtual machine
- Based on an JMX core where other pieces of the system are plugged in
- Supports JNDI, Servlet/JSP (Tomcat or Jetty), EJB, JTS/JTA, JCA, JMS
- Also supports Clustering (JavaGroups), Web Services (Axis), and IIOP integration (JacORB)
- Production release version is 3.2.1. Developer release version is 4.0.0DR2
- Released under the LGPL
Setup JBoss
The JBoss project is hosted on Source Forge.
The Files section contains all JBoss releases since 2.2.
The files page contains sections named JBoss, JBoss-Jetty, JBoss-Tomcat.
For this talk we will use jboss-3.2.1_tomcat-4.1.24.zip.
Installation is easy:
$ cd /opt
$ unzip /download/jboss-3.2.1_tomcat-4.1.24.zip
This creates the JBoss directory structure. The server subdirectory houses the minimal, default, and all configuration sets.
To run a configuration set, say all, simply do:
$ cd /opt/jboss-3.2.1_tomcat-4.1.24/bin
$ ./run.sh -c all
JMX Consol

Web Console

A Closer Look
bin contains run.sh, shutdown.sh, and bootstrapping jar files.
client contains jar files that must be specified when compiling J2EE applications.
Note that servlet.jar is in server/default/lib. The server does not use this directory at run time.
docs contains DTDs for deployment descriptors as well as data source configuration scripts
for supported RDBMSs.
lib contains jar files needed to by JBoss. Do not put user jar files into this Directory.
server contains the “factory” configuration sets. New configuration sets can be created here,
starting with a copy of one of the pre-configured sets.
For each configuration set, conf contains configuration files,
deploy contain deployed system resources and hot-deployable user applications,
and lib contain non-hot-deployable jar files used by the configuration set.
The data, log, and tmp directories are created if necessary
when the server is started. The log/server.log file contains lots of useful information.
Ant, XDoclet, Etc.
Ant is an indispensable build tool for Java development.
XDoclet is a must have for EJB development.
JUnit is necessary for test-first design and development.
Download the latest releases and install by unpacking, and update your PATH and CLASSPATH:
$ cd /opt
$ tar jxvf /download/apache-ant-1.5.3-1-bin.tar.bz2
$ unzip /download/junit3.8.1.zip
$ tar zxvf /download/xjavadoc-1.0.tar.gz
$ mkdir xdoclet-1.2b3; cd xdoclet-1.2b3
$ tar zxvf /download/xdoclet-bin-1.2b2.tar.gz
We also use CVS, MySQL, and PostgreSQL, which comes with Red Hat Linux 9.0.
CVS and PostgreSQL is also available as part of Cygwin for Windows.
JBoss as a Service
The Java Service Wrapper can install JBoss as a Windows service or Unix daemon.Its documentation uses JBoss as an example ;).
It consists of:
· a native executable wrapper (Wrapper.Exe)
· a native shared library libwrapper.so (Wrapper.Dll)
· a Java library wrapper.jar
· a few shell scripts (batch files)· and a configuration file wrapper.conf
All of these files are copied to JBoss’s bin directory.
The wrapper.conf file is modified to suit JBoss’s needs.
On Windows, batch files are provided to install
and uninstall JBoss as a service. On Red Hat Linux,
the shell script can be softlinked to /etc/rc.d/init.d to serve as init-script.
Data Sources
JBoss uses JCA to configure JDBC data sources. To configure a data source, we need:
· The JDBC driver jar file and its java.sql.Driver class name
· The JDBC URL
· The user name and password
docs/examples/jcs contains data source templates:
oracle-ds.xml, mysql-ds.xml, postgres-ds.xml, etc.To configure a data source available to a configuration set, we simply:
· Copy the JDBC driver to its lib directory
· Copy the appropriate *-ds.xml to its deploy director
· Modify the *-ds.xml to reflect the correct JDBC URL, user name and password
For Oracle, transaction-service.xml also needs modification.
See also: Start a Project with JBoss
Source: http://www.weiqigao.com/articles/jboss/foil01.html
Related posts:



Comments
No comments yet.
Leave a comment