JBoss AS 7 introduction

jboss 7 tutorialThis is an introduction tutorial to the newest JBoss AS 7 which appeared in the download section for the first time in Nov 2010. This tutorial has been recentely updated to reflect the changes introduced in the 7.1.0 Beta release of the application server. Keep on reading to learn more about AS 7 !

JBoss application server can be freely downloaded from the community site: http://www.jboss.org/jbossas/downloads/
JBoss AS 7 does not come with an installer; it is simply a matter of extracting the compressed archive.

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 -Dorg.jboss.resolver.
warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 - Dsun.rmi.dgc.

 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: http://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-cli.bat script (or jboss-admin.sh for Linux users) and you will be able to manage the application server via a shell interface. Now issue the connect [Ipaddress:port] command to connect to the management interface:

[disconnected /] connect
Connected to localhost:9999

Connecting to a remote host

 Starting from the 7.1.0 release there is security enabled by default on the AS 7.1 distribution for remote clients. Thus management interfaces are secured by default to prevent unauthorized remote access whilst still allowing access for local users for an easier out of the box experience.

If you are connecting to a remote host controller, then you need to provide your credentials:

./jboss-cli.sh --connect
Authenticating against security realm:
Connected to standalone controller at
[[email protected]:9999 /]

Check this tutorial to see how to create new management users with JBoss AS 7.

Stopping JBoss

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

 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-cli.bat --connect command=:shutdown # Windows
jboss-cli.sh --connect command=:shutdown # Unix / Linux

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 confi guration 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

The new server structure

The first thing you’ll notice when you browse through the application server folders is that its file system is basically divided into two core parts: the dichotomy reflects the distinction between standalone servers and domain servers.


JBoss as 7 tutorial


A JBoss domain is used to manage and coordinate a set of application server instances. JBoss AS 7 in domain mode spawns multiple JVMs which build up the domain. Besides the AS instances, two more processes are created: the Domain Controller which acts as management control point of the domain and the Host Controller which interacts with the domain Controller to control the lifecycle of the AS instances.

jboss 7 tutorial

JBoss AS 7 running in domain mode


In order to launch JBoss AS 7 in domain mode run the domain.sh/domain.cmd script from the bin folder.

Deploying applications on JBoss AS 7

Applications are deployed differentely depending on the type of server. If you are deploying to a domain of servers then you need the Command Line Interface because the application server needs to be informed on which server group/s  the deployment is targeted.

Ex. Deploy an application on all server groups:

deploy MyApp.war --all-server-groups

Ex. Deploy an application on one or more server groups (separated by a comma):

deploy application.ear --server-groups=main-server-group

If you are deploying to a standalone server then you can either use the CLI or drop the deployment unit into the server deployments folder.


 The deployments folder is the location in which users can place their deployment content (for example, WAR, EAR, JAR, SAR fi les) to have it automatically deployed into the server runtime. Users, particularly those running production systems, are encouraged to use the JBoss AS management APIs to upload and deploy deployment content instead of relying on the deployment scanner subsystem that periodically
scans this directory


As soon as the deployer HD scanner detects the application, the module is moved to the work folder of the application, leaving a placeholder Test.war.deployed file in the deployments folder.

jboss 7 tutorial

Note: With the default configuration, packaged archives (.ear, .war, .jar, .sar) are automatically deployed. Exploded archives need adding a .dodeploy empty file in the deployments folder to trigger deployment.