JBoss.orgCommunity Documentation

Chapter 5. Installation With Source Download

5.1. Download and Installation
5.2. Installing and configuring ANT
5.3. Building with Apache ANT
5.4. Java6 Notes

You can download the zip source file from http://labs.jboss.com/jbossas/downloads/.

  • Uncompress jboss-<release>-src.tar.gz to extract the archive contents into the location of your choice. You can do this using the tar archiving utility in Linux (or any other compatible extraction tool). In this example we are assuming your source files were copied in the /jboss folder.

    [user@localhost]$ cd /jboss
                                [user@localhost]$ tar -xvf jboss-<release>-src.tar.gz

  • You should now have a directory called jboss-<release>-src.tar.gz. The next step is to build your source files. In this example we are using Apache ANT. This is discussed in the following section.

Apache Ant is a Java-based build tool. Instead of using an extended model using shell-based commands, Ant is extended using Java classes that use XML-based configuration files. The configuration files call out a target tree that executes various tasks. Each task is run by an object that implements a particular Task interface. This gives you the ability to perform cross platform builds. Please also note that if needed, Ant provides an <exec> task that allows commands to be executed based on the Operating System it is executing on. For more information on Apache ANT please click here.

You will need to build your JBoss Application Server source files before you can run the application server. Apache Ant is shipped with the JBoss Application Server source files and can be executed from the <source_directory>/tools/bin directory.

The source files can also be built using Apache Maven which is also shipped with the JBoss Application Server source files under <source_directory>/tools/maven directory. For more information about Apache Maven, please refer to http://maven.apache.org/.

Like Java, you also need to set the environment variables for Apache ANT and/or Apache Maven. The following example illustrates a desirable configuration for the .bashrc file. In the example the file is edited using the gnome text editor (gedit).

[user@localhost ~]$ gedit .bashrc
                # Source global definitions
                if [ -f /etc/bashrc ]; then
                # User specific aliases and functions
                # The following are the environment variables for Java , ANT and Maven
                export JAVA_HOME=/usr/java/jdk1.6.0_07/
                export PATH=$PATH:$JAVA_HOME/bin
                export ANT_HOME=/home/downloads/jboss-<source_directory>/tools/
                export PATH=$PATH:$ANT_HOME/bin
                export MAVEN_HOME=/home/downloads/jboss-<source_directory>/tools/maven
                export PATH=$PATH:$MAVEN_HOME/bin

To implement the changes you've made to the .bashrc file, type the following on a terminal.

[user@localhost ~]$ source .bashrc
                [user@localhost ~]$

If any errors are displayed, please check your .bashrc file for errors and ensure that all directory paths are correct.

To build the JBoss Application Server source files with Apache ANT, from a terminal change directory to where the unzipped source files are. In the following example we are assuming that the source files were copied and unzipped in the logged in user's downloads folder.

[user@localhost]$ cd /home/user/downloads/jboss-<release>-src/build
[504][valkyrie: jboss-5.0.0.GA-src]$ ls
aspects	          hibernate-int  security
bootstrap         iiop           server
build			  j2se           spring-int
client			  jbossas        system
cluster			  jmx            system-jmx
component-matrix  jmx-remoting   testsuite
connector         main           thirdparty
console           management     tomcat
deployment        mbeans         tools
docbook-support   messaging      varia
ejb3              pom.xml        webservices
embedded          profileservice

From the contents of the build directory above, you can see the build.xml file which is used by Apache ANT as a configuration file when building your source files. The next step is to perform the build using Apache ANT as illustrated below.

[571][valkyrie: build]$ ant
Buildfile: build.xml

Trying to override old definition of task property

[copy] Copying 1 file to /Users/svn/Releases/jboss-5.0.0.GA-src/build


[echo] groups:  default
[echo] modules: bootstrap,main,j2se,mbeans,jmx,system,system-jmx,security,server,deployment,jbossas/remoting,jmx-remoting,jbossas/jmx-remoting,messaging,cluster,varia,iiop,aspects,profileservice,connector,management,ejb3,tomcat,webservices,hibernate-int,console,spring-int


[echo] Calling mvn command located in /Users/svn/Releases/jboss-5.0.0.GA-src/build/../tools/maven


Total time: 21 minutes 34 seconds

A successful build will have the above message. The first time you build the tree it will download a large number of thirdparty files from maven repositories. After that, these will be used from the local repository and the build will be much faster. Typical initial build times can be 30 minutes with subsequent build times 3 minutes. If your build fails, please check the error log and ensure that your configuration files and environment variables are correctly set. The JBoss Application Server files are built under the build/output/jboss-<release> directory as indicated below.

[578][valkyrie: build]$ ls
VersionRelease.java	build.sh		local.properties
build-distr.xml		build.xml		output
build-release.xml	docs			pom.xml
build.bat		eclipse.psf
build.log		etc
[579][valkyrie: build]$ ls output/
[580][valkyrie: build]$

The jboss-<release> directory contains your successful JBoss Application Server files. You can copy this folder to a different location or run the server from this folder after setting the JBOSS_HOME environment variable in your .bashrc file. Next you need to set your JBOSS_HOME environment variables. This is discussed in Chapter 6, Setting the JBOSS_HOME variable.

JBossAS 5.0.0.GA can be compiled with both Java5 and Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/client directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:


The other option is to download the jdk6 distribution (jboss-5.0.0.GA-jdk6.zip) in which case no configuration changes are required. If you still have problems using JBoss with a Sun Java 6 runtime, you may want to set -Dsun.lang.ClassLoader.allowArraySyntax=true, as described in JBAS-4491. Other potential problems under a Java 6 runtime include:

ORB getting prematurely destroyed when using Sun JDK 6 (see Sun Bug ID: 6520484)
Unimplemented methods in Hibernate for JDK6 interfaces.
When JBossAS 5 is compiled with Java 6, support for the extended JDBC 4 API is included in the binary, however this can only be used under a Java 6 runtime. In this case no manual configuration steps are necessary.