JBoss AS is a full Java application server and hence it requires a Virtual Machine for the Java Platform to run on.
At the time of writing, the J2SE 1.7 has been finally released and it’s available for download. Although, there are no known issues with this Java release, there are still a few users who have tested it intensively with the new application server. For this reason, at the moment, we suggest you start with J2SE 1.6 and consider moving to the new Java platform in the near future.
So, let’s move on the Oracle download page, which now hosts all JDK downloads:
Choose to download the latest JDK/JRE which is, at the time of writing, the JDK 1.6 Update 26.
The download will take a few minutes depending how fast your network is. Once the download is complete, run the executable file to start the installation. (The actual name of the installer varies, also if you are on a 32-bit system or 64-bit. However, the steps will be the same, just the name will change).
jdk-6u26-windows-i586.exe # Windows
sh jdk-6u26-linux-i586.bin # Linux
If you are installing on a Linux/Unix box, you can safely accept all the defaults given to you by the setup wizard. The Windows users should stay away from the installation paths that include empty spaces, such as C:Program Files, as this leads to some issues when you are referencing the core libraries. An installation path such as C:SoftwareJava or simply C:Java is a better alternative.
When the installation is complete, we need to update a couple of settings on the computer so it can interact with Java. The most important setting is JAVA_HOME, which is directly referenced by JBoss startup script.
If you are running Windows XP-2000, follow these steps:
Name the new variable as JAVA_HOME, and give a value of the path to your JDK installation; I would recommend something like: C:Javajdk1.6.0_26.
Because of increased security in Windows Vista, standard users must have User Account Control (UAC) turned on to change the environment variables, and the change must be completed via user accounts. In the User Accounts window, under Tasks, select Change my environment variables. Use the New, Edit or Delete buttons to amend environment variable.
Now it’s time to modify the system’s PATH variable. Double-click on the PATH system variable. In the box that pops up, navigate to the end of the Variable Value line, add a semicolon to the end, and then add the path to your JDK. This will be something like %JAVA_HOME%bin.
Unix/Linux users can add the following commands in the user’s profile scripts:
Installing JBoss AS 7 JBoss application server can be freely downloaded from the community site: HTTP://WWW.JBOSS.ORG/JBOSSAS/DOWNLOADS/.
As you can see from the above picture, you can choose between the 7.0.2 final release (Arc) and the newer 7.1.0 Beta. If you plan to use JBoss AS 7 in production, we suggest you using the former stable release which provides all the functionalities contained in this tutorial except for one mentioned in Chapter 4 (“Adding a Remote EJB client”).
The 7.0.2 release is available in the Web profile certified distribution and in the full distribution, which contains all the available server modules.
On the other hand, if you are on a learning path to the new server, just proceed to the new 7.1.0 Beta release, which is available in the single EE6 server release.” Choose to download the full server distribution. You will be then warned that this download is part of a community release and, as such, it is not yet fully supported. As said before, RedHat maintains the Enterprise releases of JBoss middleware and, hopefully, the AS 7 will be soon part of it.
JBoss AS 7 does not come with an installer; it is simply a matter of extracting the compressed archive. Windows users can simply use any uncompress utility, such as WinZip, or WinRAR taking care to choose a folder, which doesn’t contain empty spaces. Unix /Linux should use the unzip shell command to explode the archive: unzip jboss-as-7.0.2.Final.zip
Unix/Linux users should be aware that JBoss AS does not require root privileges as none of the default ports used by JBoss are below the privileged port range of 1024. To reduce the risk of users gaining root privileges through the JBoss AS, install and run JBoss as a non-root user.
After you have installed JBoss, it is wise to perform a simple startup test to validate that there are no major problems with your Java VM/operating system combination. To test your installation, move to the bin directory of your JBOSS_HOME directory and issue the following command:
standalone.bat # Windows users
$ standalone.sh # Linux/Unix users
The above command starts up a JBoss standalone instance that’s equivalent of starting the application server with the run.bat/run.sh script used by earlier AS releases. You will notice how amazingly fast is starting the new release of the application server; this is due to the new modular architecture, which only starts up necessary parts of the application server container needed by loaded applications.
If you need to customize the startup properties of your application server, then you need to open the standalone.conf (or standalone.conf.bat for the Windows users) where the memory requirements of JBoss are declared. Here’s the Linux core section of it:
if [ “x$JAVA_OPTS” = “x” ]; then
JAVA_OPTS=”-Xms64m -Xmx512m -XX:MaxPermSize=256m
So, by default, the application server starts with a minimum memory requirement of 64MB of heap space and a maximum of 512MB. This will be just enough to get started, however, if you need to run a core Java EE application on it, you will likely require at least 1GB of heap space or 2GB or more depending on your application type. Generally speaking, 32-bit machines cannot execute a process whose space exceeds 2GB, however on 64 bit machines, there’s essentially no limit to process size.
You can verify that the server is reachable from the network by simply pointing your browser to the application server’s welcome page, which is reachable by default at the well-known address: https://localhost:8080.
Connecting to the server with the command line interface If you have been using previous releases of the application server you might have heard about the twiddle command-line utility that queried the MBeans installed on the application server. This utility has been replaced by a more sophisticated interface named the Command Line Interface (CLI), which can be found in the JBOSS_HOME/bin folder.
Just launch the jboss-admin.bat script (or jboss-admin.sh for Linux users) and you will be able to manage the application server via a shell interface.
We have just started an interactive shell session which is also able to use the command-line completion (by pressing the Tab key) to match partly-typed command names. No more searches for finding the exact syntax of commands!
In the previous screenshot, we have just connected to the server using the connect command, which by default uses the loopback server address and plugs into the port 9999.
The command-line interface is discussed in depth in Chapter 7, Managing the Application Server, which is all about the server-management interfaces; We will, however, have an initial taste of its basic functionalities in the following sections to get you accustomed to this powerful tool.
Probably the easiest way to stop JBoss is by sending an interrupt signal with Ctrl+C.
However, if your JBoss process was launched in the background or rather is running on another machine (see next), then you can use the CLI interface to issue an immediate shutdown command:
[disconnected /] connect
Connected to localhost:9999
[localhost:9999 /] :shutdown
Locating the shutdown script There is actually one more option to shutdown the application server, which is pretty useful if you need to shut down the server from within a script. This option consists of passing the –connect option to the admin shell, thereby switching off the interactive mode:
jboss-admin.bat –connect command=:shutdown # Windows
jboss-admin.sh –connect command=:shutdown # Unix / Linux
Stopping JBoss on a remote machine Shutting down the application server, which is running on a remote machine, is just a matter of connecting and providing the server’s remote address to the CLI:
[disconnected /] connect 192.168.1.10
Connected to 192.168.1.10:9999
[192.168.1.10:9999 /] :shutdown
Since JBoss AS 7.1.0 Beta1 accessing remotely the CLI requires authentication. Check out Chapter 10 for more information about it.
Restarting JBoss The command-line Interface contains a lot of useful commands. One of the most interesting options is the ability to reload all or parts of the AS configuration using the reload command.
When issued on the root node path of the AS server, it is able to reload the services configuration:
[disconnected /] connect
Connected to localhost:9999
[localhost:9999 /] :reload
Free Demo for Corporate & Online Trainings.