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 http://jboss.sourceforge.net/jbosside/updates.
  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 http://jboss.sourceforge.net/jbosside/updates.
  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 java.io.IOException;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.

devx-admin

devx-admin

Share the Post:
USA Companies

Top Software Development Companies in USA

Navigating the tech landscape to find the right partner is crucial yet challenging. This article offers a comparative glimpse into the top software development companies

Software Development

Top Software Development Companies

Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in

India Web Development

Top Web Development Companies in India

In the digital race, the right web development partner is your winning edge. Dive into our curated list of top web development companies in India,

USA Web Development

Top Web Development Companies in USA

Looking for the best web development companies in the USA? We’ve got you covered! Check out our top 10 picks to find the right partner

Clean Energy Adoption

Inside Michigan’s Clean Energy Revolution

Democratic state legislators in Michigan continue to discuss and debate clean energy legislation in the hopes of establishing a comprehensive clean energy strategy for the

Chips Act Revolution

European Chips Act: What is it?

In response to the intensifying worldwide technology competition, Europe has unveiled the long-awaited European Chips Act. This daring legislative proposal aims to fortify Europe’s semiconductor

USA Companies

Top Software Development Companies in USA

Navigating the tech landscape to find the right partner is crucial yet challenging. This article offers a comparative glimpse into the top software development companies in the USA. Through a

Software Development

Top Software Development Companies

Looking for the best in software development? Our list of Top Software Development Companies is your gateway to finding the right tech partner. Dive in and explore the leaders in

India Web Development

Top Web Development Companies in India

In the digital race, the right web development partner is your winning edge. Dive into our curated list of top web development companies in India, and kickstart your journey to

USA Web Development

Top Web Development Companies in USA

Looking for the best web development companies in the USA? We’ve got you covered! Check out our top 10 picks to find the right partner for your online project. Your

Clean Energy Adoption

Inside Michigan’s Clean Energy Revolution

Democratic state legislators in Michigan continue to discuss and debate clean energy legislation in the hopes of establishing a comprehensive clean energy strategy for the state. A Senate committee meeting

Chips Act Revolution

European Chips Act: What is it?

In response to the intensifying worldwide technology competition, Europe has unveiled the long-awaited European Chips Act. This daring legislative proposal aims to fortify Europe’s semiconductor supply chain and enhance its

Revolutionized Low-Code

You Should Use Low-Code Platforms for Apps

As the demand for rapid software development increases, low-code platforms have emerged as a popular choice among developers for their ability to build applications with minimal coding. These platforms not

Cybersecurity Strategy

Five Powerful Strategies to Bolster Your Cybersecurity

In today’s increasingly digital landscape, businesses of all sizes must prioritize cyber security measures to defend against potential dangers. Cyber security professionals suggest five simple technological strategies to help companies

Global Layoffs

Tech Layoffs Are Getting Worse Globally

Since the start of 2023, the global technology sector has experienced a significant rise in layoffs, with over 236,000 workers being let go by 1,019 tech firms, as per data

Huawei Electric Dazzle

Huawei Dazzles with Electric Vehicles and Wireless Earbuds

During a prominent unveiling event, Huawei, the Chinese telecommunications powerhouse, kept quiet about its enigmatic new 5G phone and alleged cutting-edge chip development. Instead, Huawei astounded the audience by presenting

Cybersecurity Banking Revolution

Digital Banking Needs Cybersecurity

The banking, financial, and insurance (BFSI) sectors are pioneers in digital transformation, using web applications and application programming interfaces (APIs) to provide seamless services to customers around the world. Rising

FinTech Leadership

Terry Clune’s Fintech Empire

Over the past 30 years, Terry Clune has built a remarkable business empire, with CluneTech at the helm. The CEO and Founder has successfully created eight fintech firms, attracting renowned

The Role Of AI Within A Web Design Agency?

In the digital age, the role of Artificial Intelligence (AI) in web design is rapidly evolving, transitioning from a futuristic concept to practical tools used in design, coding, content writing

Generative AI Revolution

Is Generative AI the Next Internet?

The increasing demand for Generative AI models has led to a surge in its adoption across diverse sectors, with healthcare, automotive, and financial services being among the top beneficiaries. These

Microsoft Laptop

The New Surface Laptop Studio 2 Is Nuts

The Surface Laptop Studio 2 is a dynamic and robust all-in-one laptop designed for creators and professionals alike. It features a 14.4″ touchscreen and a cutting-edge design that is over

5G Innovations

GPU-Accelerated 5G in Japan

NTT DOCOMO, a global telecommunications giant, is set to break new ground in the industry as it prepares to launch a GPU-accelerated 5G network in Japan. This innovative approach will

AI Ethics

AI Journalism: Balancing Integrity and Innovation

An op-ed, produced using Microsoft’s Bing Chat AI software, recently appeared in the St. Louis Post-Dispatch, discussing the potential concerns surrounding the employment of artificial intelligence (AI) in journalism. These

Savings Extravaganza

Big Deal Days Extravaganza

The highly awaited Big Deal Days event for October 2023 is nearly here, scheduled for the 10th and 11th. Similar to the previous year, this autumn sale has already created

Cisco Splunk Deal

Cisco Splunk Deal Sparks Tech Acquisition Frenzy

Cisco’s recent massive purchase of Splunk, an AI-powered cybersecurity firm, for $28 billion signals a potential boost in tech deals after a year of subdued mergers and acquisitions in the

Iran Drone Expansion

Iran’s Jet-Propelled Drone Reshapes Power Balance

Iran has recently unveiled a jet-propelled variant of its Shahed series drone, marking a significant advancement in the nation’s drone technology. The new drone is poised to reshape the regional

Solar Geoengineering

Did the Overshoot Commission Shoot Down Geoengineering?

The Overshoot Commission has recently released a comprehensive report that discusses the controversial topic of Solar Geoengineering, also known as Solar Radiation Modification (SRM). The Commission’s primary objective is to

Remote Learning

Revolutionizing Remote Learning for Success

School districts are preparing to reveal a substantial technological upgrade designed to significantly improve remote learning experiences for both educators and students amid the ongoing pandemic. This major investment, which

Revolutionary SABERS Transforming

SABERS Batteries Transforming Industries

Scientists John Connell and Yi Lin from NASA’s Solid-state Architecture Batteries for Enhanced Rechargeability and Safety (SABERS) project are working on experimental solid-state battery packs that could dramatically change the

Build a Website

How Much Does It Cost to Build a Website?

Are you wondering how much it costs to build a website? The approximated cost is based on several factors, including which add-ons and platforms you choose. For example, a self-hosted