Chapter 2. Manage JBoss AS from Red Hat Developer Studio

Red Hat Developer Studio ships with JBoss EAP v.4.2 bundled. When you followed the default installation of Red Hat Developer Studio, you already have a JBoss 4.2 server installed and defined. To run JBoss AS 4.2 you need JDK 1.5. JDK 6 is not formally supported yet, although you may be able to start the server with it.

2.1. How to manage the JBoss AS bundled in RHDS

2.1.1. Starting JBoss server

Starting JBoss server is quite simple. Red Hat Developer Studio allows you control its behaviour through a special toolbar: start it in a regular or debug mode, stop it, or restart it.

  1. To launch the server click the green-with-white-arrow icon on the JBoss Server View or right click server name in this view and select "Start". If this view is not open select Window > Show View > Other > Server > JBoss Server View:

Starting from icon

Figure 2.1. Starting from icon

Starting from JBoss Server view

Figure 2.2. Starting from JBoss Server view

While launching Server output will be written to the Console view:

When server has started you should see "Started" right to its name in JBoss Server view (column "Status").

Server is started

Figure 2.3. Server is started

To see event log after the server is started expand "Event Log" branch beneath JBoss Servers View:

Event Log

Figure 2.4. Event Log

2.1.2. Stopping JBoss server

To stop the server click the Stop icon in JBoss Server View or right click the server name and press Stop.

Stopping server

Figure 2.5. Stopping server

When the server is stopped you will see "Stopped" next to its name in Status column.

2.1.3. Server Container Preferences

You can control how Red Hat Developer Studio interacts with servlet containers in Preferences. Select Window > Preferences > JBoss Tools > JBoss Servers and switch to the desired server:

Server preferences

Figure 2.6. Server preferences

Also you can double click the server name in JBoss Server view and open an Overview of the server. Here you can specify some common settings: host name, server name, runtime and so on.

Server overview

Figure 2.7. Server overview

2.2. How to manage JBoss AS instances in RHDS

Although Red Hat Developer Studio works closely with JBoss EAP 4.2 we do not ultimately tie you to any particular server for deployment. There are some servers that Studio supports directly (through the bundled Eclipse WTP plug-ins). Suppose you want to deploy the application to JBoss 4.2.1 server. First of all you need to install it.

2.2.1. JBoss AS Installation

  1. Download the binary package of JBoss 4.2.1 and save it on your computer: http://labs.jboss.com/jbossas/downloads

It does not matter where on your system you install JBoss. Note, however, that installing JBoss into a directory that has a name containing spaces causes problems in some situations with Sun-based VMs. So try to avoid using installation folders that have spaces in their names.

There is no requirement for root access to run JBoss on UNIX/Linux systems because none of the default ports are within the 0-1023 privileged port range.

  1. After you have the binary archive you want to install, use the JDK jar tool (or any other ZIP extraction tool) to extract the jboss-4.2.1.zip archive contents into a location of your choice. The jboss-4.2.1.tgz archive is a gzipped tar file that requires a gnutar compatible tar which can handle the long pathnames in the archive. The extraction process will create a jboss-4.2.1 directory.

2.2.2. Adding and configuring JBoss server

Now we should add just installed server into server manager in Red Hat Developer Studio.

  1. Open the JBoss Server View by selecting Window > Show View > Other > Server > JBoss Server View. You will see JBoss Server view.

  2. Right click anywhere in this view and select New Server.

  3. Select JBoss, a division of Red Hat > JBoss v4.2 and click the "Installed Runtimes" button to select a new installed runtime.

Selecting server type

Figure 2.8. Selecting server type

  1. Click "Add" button to add a new jboss runtime.

  2. Select JBoss, a division of Red Hat > JBoss v4.2 and press Next.

Installed Runtimes

Figure 2.9. Installed Runtimes

  1. In the next step make Red Hat Developer Studio to know where you have installed the server and define JRE.

Defining JBoss Runtime

Figure 2.10. Defining JBoss Runtime

Note:

When adding a new server you will need to specify what JRE to use. It is important to set this value to a full JDK, not JRE. Again, you need a full JDK to run Web applications, JRE will not be enough.

  1. In the following window leave all settings default or give your name to a new jboss server and press Finish.

Adding new runtime

Figure 2.11. Adding new runtime

A new runtime will now appear in the Preferences > Server > Installed Runtimes dialog.

Runtime is added

Figure 2.12. Runtime is added

  1. Click OK. Then select a new added runtime in Server runtime drop down list and click Next button twice.

Choosing runtime

Figure 2.13. Choosing runtime

  1. In the last wizard's dialog modify the projects that are configured on the server and click Finish.

Configuring Projects

Figure 2.14. Configuring Projects

A new JBoss server should now appear in JBoss Server View.

New JBoss Server

Figure 2.15. New JBoss Server