JBoss Meets Eclipse: Introducing the JBoss-IDE

JBoss Meets Eclipse: Introducing the JBoss-IDE

Boss, the open source, J2EE-based application server, has been a favorite of the Java community for a long time. But recently JBoss got a handy new toolkit, thanks to Eclipse—one that may just help the product go from full steam to mainstream.

While JBoss has always been applauded for being robust and scalable, with support for security, load balancing, clustering, and transactional capability, what it hasn’thad is a GUI-based IDE. And that has left the mass marketplace solely in the hands of closed source competitors such as IBM, BEA, and Borland. Those who prefer can always continue to configure JBoss using command line tools, but thanks to the Eclipse project, JBoss has an IDE that plugs into the Eclipse development framework, making the product a legitimate option for the thousands of developers who prefer a GUI.

A few Eclipse plugins already have support for JBoss, but the JBoss-IDE plugin is by far the easiest to install, update, and use. The plugin supports starting and stopping servers, debugging server-side code, packaging archive files, and deploying archive files. It also has support for XDoclet code-generation. Best of all, the JBoss-IDE is developed and maintained by JBoss Inc., the makers of the JBoss Application Server itself

In this article, I’ll show you how to install and configure the JBoss-IDE plugin and then walk you through the steps of creating a simple Hello World application, packaging it, and deploying it to a JBoss server.

Installing the Plugin
Many Eclipse plugins are packaged as a ZIP file that you download and unzip directly into Eclipse’s plugin directory. But the JBoss-IDE uses Eclipse’s built-in update management functionality which makes initial installation easy and subsequent updates even easier.

Author’s Note: If you are behind a proxy, you’ll have to define the proxy server before you can run the update manager. Go to Window—>Preferences—>Install/Update, select Enable HTTP Proxy Connection and define values for Host Address and Port. There is more documentation available on the install process on the JBoss IDE Web page.

Eclipse 2.x

  1. Click Help—>Software Updates—>Update Manager.
  2. In the Feature Updates view, right click and select New—>Site Bookmark.
  3. Select an unused name for the bookmark and then set the bookmark at
  4. Expand the bookmark that was added and select JBoss-IDE 1.0/Eclipse 2.1.
  5. You should now see the available versions of the plugin. Select the latest version.
  6. You will be prompted to restart Eclipse.

Eclipse 3.x

  1. Click Help—>Software Updates—>Find and Install.
  2. Select Search for new features to install.
  3. Click Add Update Site.
  4. Select an unused name for the update site and then set the boomark at
  5. Expand the update site that was added and select JBoss-IDE 1.0/Eclipse 3.0.
  6. You should now see the available versions of the plugin. Select the latest version.
  7. You will be prompted to restart Eclipse.

Adding the Shortcuts to the Top Menu
The JBoss-IDE plugin provides a set of buttons to start, stop, and terminate a server, as well as view the server console and log files. These buttons only operate on a single server that you define as a Default Server. Configuring the Default Server will come later; for now, here’s how to make the buttons visible on the toolbar:

Eclipse 2.x

  1. Right click on the top toolbar.
  2. Select Customize Perspective.
  3. Expand Other.
  4. Check Default Server.
  5. Click OK.

Eclipse 3.x

  1. Right click on the top toolbar.
  2. Select Customize Perspective.
  3. Select Commands.
  4. Check Default Server in the Available Command Groups pane.
  5. Click OK.
Figure 1: Use the Debug Configuration to launch the JBoss server.

Configuring and Launching a Server
Download the JBoss server here.

In order to start your JBoss server, you must create a Debug Configuration. Running JBoss in a Debug Configuration allows you to set and use breakpoints in your server code. Go to Run—>Debugand you should see several new “JBoss” Configurations in the left pane. Click on the one that matches the version of JBoss that you are running. The Debug option on the right allows you to define which perspective Eclipse will switch to when you launch your JBoss server. I prefer not having Eclipse change perspectives when my server starts, so I change it from Debug to None.

Figure 2: Define a Default Server to use the buttons at the top of the tool bar.

After defining the perspective, click New to create a new instance of your JBoss configuration. Give your configuration a name and point it to the home directory for your JBoss server (see Figure 1).

Click on Close and then go to Window—>Preferences—>JBoss IDE—>Launcher. You’ll need to designate a Default Server so that you can use the buttons that we added to the top tool bar earlier (see Figure 2).

After you click OK, you should be able to use the buttons that were added to the top tool bar earlier.

Figure 3: Your source and output configuration should look like this.

Creating a Servlet
Now to learn how to use the plugin, you’ll create a simple “Hello World!” Servlet and deploy it to JBoss.

Put your source code (.java files) in a source folder and your compiled classes (.class files) in an output folder. Follow these steps to configure your source and output folders (Figure 3).

  1. Right-click on your project in the Package Explorer.
  2. Go to Properties—>Java Build Path.
  3. Click on the Source tab.
  4. Click on Add Folder.
  5. Click on Create New Folder.
  6. Set the folder name to “src”.
  7. Select Yes when it asks you to remove the project as a source folder and to create a “bin” folder.

Next, you need to set your CLASSPATHby defining the libraries (JAR files) that Eclipse should use to compile your code. You also need to add a JAR file that will allow you to compile a Servlet. Luckily, Eclipse comes equipped with a Tomcat plugin, which contains the library you will need you to compile a servlet.

Figure 4: This is how your libraries (CLASSPATH) should appear after adding the servlet.jar.

Follow these steps (see Figure 4):

  1. Click on the Libraries Tab (while still under Properties—>Java Build Path).
  2. Click Add Variable.
  3. Select ECLIPSE_HOME and click Extend.
  4. Navigate to the plugins/org.eclipse.tomcat.4.1.x directory.
  5. Select servlet.jar and click OK.
  6. Click OK to exit the properties dialog.

Now, create a class called HelloWorldSerlvet in the com.devx.examplepackage, using the following code in your servlet:

package com.devx.example;import;import javax.servlet.ServletException;import javax.servlet.ServletOutputStream;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class HelloWorldServlet extends HttpServlet{	               protected void service(HttpServletRequest request, HttpServletResponse response)		                           throws ServletException, IOException	    {		                           ServletOutputStream out = response.getOutputStream();		                           out.println("

Hello World!

"); }}
Figure 5: This is how the project structure looks after creating all the necessary files.

Next, you need a deployment descriptor so that JBoss will know how to access your Servlet. The deployment descriptor (web.xml) goes under a folder called WEB-INF in the .war file. Create a folder under src called WEB-INF. Then, create a file called web.xmlin that folder, using the following source.

				HelloWorldServlet		com.devx.example.HelloWorldServlet					HelloWorldServlet		/Hello	

After all is said and done, your project structure should look like Figure 5.

Setting Up the Packaging Configuration
Before you can deploy your application to JBoss, you need to define the structure of your WAR file through a Packaging Configuration, which you then run to create a WAR file.

Figure 6: Here’s how to define the packaging configuration, from inside the project properties.

Here’s how to create a Packaging Configuration:

  1. Right click on your project in the Package Explorer.
  2. Select Properties—>Packaging Configurations.
  3. Right click in the right frame and click Add Std. Archive.
  4. Select Standard-WAR.war and click OK.
  5. Right click on the configuration and click Edit.
  6. Rename it to helloworld.war.
  7. Expand the configuration.
  8. Right click on the line with Manifest.MF and remove it.
  9. Make sure your configuration looks like that shown in Figure 6.

Click OK and you should see a file in your project called packaging-build.xml.

Figure 7: The Target Choice screen allows you to select the instance of JBoss to which you wish to deploy.

Creating and Deploying the WAR File
Create a WAR file by right-clicking on your project and clicking Run Packaging. You will have to right-click on the project and click Refresh before you see the WAR file. The file should be in the top level of you project.

Right click on the WAR file, select Deployment, and then Deploy To. You will see a Target Choice dialog appear, allowing you to select which application server you would like to deploy to, as shown in Figure 7.

Figure 8: Test out the Hello World Servlet! Do your results match?

I have JBoss 3.2.2 and JBoss 3.2.3 configured on my machine, thus both servers are available. After selecting the target you wish to deploy to, you should see a dialog that confirms that the application was deployed.

Now, pull up your Web browser and try it out. Go to http://localhost:8080/helloworld/Hello, as shown in Figure 8.

In this article, you learned how to install the JBoss-IDE plugin in Eclipse. You also learned how to configure a JBoss server and how to package and deploy a simple application that server. Keep a lookout for a follow-up to this article in which I will show you how to use the XDoclet features of the JBoss-IDE plugin.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist