Skip to main content

NetBeans with JBoss Setup

Posted by ddevore on January 6, 2006 at 10:59 AM PST

This guide describes the setup necessary to setup NetBeans IDE 5.0 work with JBoss in preparation for developing EJBs and Web Services targeting the JBoss runtime. Once you have completed the instructions in this setup guide you will be able to create and consume EJBs and Web Services with the JBoss application server through NetBeans IDE 5.0. This will also allow you to do it all without doing any manual deployments to the JBoss application server. For more information on creating and consuming EJBs and Web Services for the JBoss server through NetBeans IDE 5.0, please see the other guides for NetBeans IDE 5.0 and JBoss.

At the time of writing this guide NetBeans IDE was in version 5.0 Beta. This guide was written using the latest development build #200601052030 to take advantage of the bug fixes since NetBeans IDE 5.0 went into beta. Also, NetBeans officially supports JBoss Application Server 4.0.3, but due to business requirements I have to use JBoss Application Server 4.0.1. So, this guide will walk through the JBoss Application Server 4.0.1 setup as well as the JBoss 4.0.3 setup.

Download Required Files

First you need to download the files needed for setup. You will need JDK 5.0, NetBeans IDE 5.0 (latest build), JBoss Application Server 4.0.3, and Sun Java System Application Server Platform Edition 8.1.

JDK 5.0

The latest JDK 5.0 can be downloaded from here http://java.sun.com/j2se/1.5.0/download.jsp. Download the latest update of the JDK. NOTE: Until NetBeans IDE 5.0 reaches final release, do not download the NetBeans IDE / JDK bundle from this page because the version of NetBeans IDE on this page is currently the final release version of NetBeans IDE 4.1. This document covers JBoss setup with NetBeans IDE 5.0 Beta version.

NetBeans IDE Version 5.0

The NetBeans 5.0 version IDE can be downloaded from the NetBeans web site at http://www.netbeans.info/downloads/download.php?a=n&p=1. You will need the latest daily build or release, which ever is newer for, version 5.0 or the 5.0 version once it has reached final release. Select the NetBeans IDE installer from the list.

JBoss Application Server 4.0.3sp1

The JBoss application server can be downloaded from SourceForge at http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942.
Please select version JBoss version 4.0.3sp1. This guide may work with earlier versions of JBoss, but they have not been tested.

Sun Java System Application Server 8.1 Platform Edition

The Sun Java System Application Server 8.1 Platform Edition is needed to create services correctly since JBoss currently does not fully support JAX-RPC. This can be downloaded at http://java.sun.com/j2ee/1.4/download.html#sdk. Select the separate bundles Sun Java System Application Server Platform Edition 8.1 2005Q2 UR2.

Installation

Although the order of installation could be done alternatively, the suggested and easiest installation is too; install the JDK first then install the NetBeans IDE 5.0. Then, proceed to install the JBoss Application Server and Sun Java System Application Server. Make note of the admin name and password you enter when you install the Sun Java System Application Server. You will need the admin name and password when you register the application server in the NetBeans IDE a little later in this guide. If you are using the JBoss installer make sure you choose the all option A full J2EE server profile with enterprise extensions. Then select the options needed for your installation. For this guide the default options were selected.

NOTE: The JBoss installer is an executable jar file to run this file use

java jar jar_file_name

Setting Up Your Environment
Setting up the environment is only needed if you plan to build the project outside the NetBeans environment. The environment setup shown here is geared toward the Windows platform. If you are using another operating system please make changes as appropriate. Also, the settings can all be set in the system properties. For setting the variables in the system properties go to the Control Panel and open the System dialog then go to the advanced tab and select Environment Variables. Here you can add the variables in the user or system variables.

To do this, set the environment variable ANT_HOME to the directory where you have Ant installed. If you have not installed Ant, then set ANT_HOME to <NETBEANS_INSTALL_DIR>\ide6\ant. Then add ANT_HOME\bin to your PATH environment variable. For my installation I have NetBeans installed in C:\Program Files\netbeans-5.0dev so for me the correct setting would be.

set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_05

set ANT_HOME= C:\Program Files\netbeans-5.0dev\ide6\ant
set PATH=%PATH%;ANT_HOME\bin

If you have ant installed and would like to use it instead of the version provided by NetBeans change the ANT_HOME above appropriately.

NetBeans Setup

Once you have NetBeans started, go to the Runtime tab at the top of the navigation pane and expand the Servers node you will notice the only server listed is a bundled Tomcat server. Right click on the Servers node and select Add Server. This will by default select the Sun Java System Application Server as the server. Since that is one that we want to add click Next. Enter the location for the installation for the server in the next screen and click Next. Enter the proper information in the next screen for the admin name and password and click Finish. The admin name and password to enter here are the admin name and password you entered during the installation of the Sun Java System Application Server.

JBoss Server Setup

The JBoss setup about the same as the Sun Server setup, but because of the different server versions there are some things that must be considered when registering a JBoss Application Server with the NetBeans IDE. In the NetBeans IDE, first right click on the Server node in the runtime tab and select Add Server. Select JBoss Application Server 4.0.3 and click Next, since this is the only JBoss setup available you must select it no matter what version of JBoss you are using; again this has been tested with JBoss 4.0.3sp1 only. Enter the installation directory for the JBoss server such as c:\jboss-4.0.3sp1 and click Next. Select the domain; it defaults to 'default'. If you are using JBoss 4.0.3 the port number is read from the configuration file and put in the port field automatically and cannot be changed in the dialog. If you are using a JBoss installation previous to JBoss 4.0.3sp1 the configuration is not read in and will only work with the default settings. If you wish to change the port numbers for JBoss 4.0.3sp1, look in:

<JBOSS_INSTALLATION_DIR>\server\default\deploy\jbossweb-tomcat55.sar\server.xml

On line 12 you will see the definition for the JBoss port number,

Change the Connector Port to your desired port number. I suggest you change this port number or the Sun Java System Application Server port number because of conflicts with the listening port. By default, both JBoss and Sun Java System Application Server listen to port number 8080. If you are using a previous version of JBoss you cannot change the default port number if you are going to deploy directly from NetBeans. If you do not change the JBoss Application Server or Sun Application Server port number please be careful when deploying the applications since you may experience some unexpected behavior such as deployments not being successful. You need to be sure you do not have both application servers running at the same time if the ports are not changed on either server.

To save yourself some potential deployment issues with using JBoss version 4.0.3, it is easiest to change the JBoss port number via the JBoss server.xml file as described above.

Server Setup

About a month ago there were some changes which made changes to the server unnecessary. So what this means is that JBoss 4.0.3sp1 works out of the box. After the server is setup in NetBeans you can deploy and test with the JBoss 4.0.3sp1 server. Keep in mind though that JBoss 4.0.3sp1 does not support documentliteral correctly for web services so if you are developing web services please insure that you set them to rpcliteral.

Conclusion

This is all there is to the setup for working with NetBeans and JBoss. Once this is done you can create and consume EJBs and Web Services with the JBoss application server through NetBeans IDE 5.0. This will also allow you to do it all without doing any manual deployments to the JBoss application server.
For more information on creating and consuming EJBs and Web Services for the JBoss server through NetBeans IDE 5.0, please see upcoming blogs for NetBeans IDE 5.0 and JBoss.

Next

EJB Creation and Consumption with NetBeans and JBoss

Related Topics >>