Integrating JBuilder 6 Personal Edition with JBoss 2.4.4_Tomcat-4.0.1

By: CodeGear

Abstract: Abstract: This document is a step-by-step guide to setting up and running a JBoss server instance, and debugging your EJB classes all from within JBuilder 6 Personal Edition. By Brent Thompson

Integrating JBuilder 6 Personal Edition with JBoss 2

Setting up the JBoss Server Instance

Before we start, on your machine you must have installed:


7 J2sdkee1.3



7 from the site


There is a JBoss Setup Wizard that will automate the process of setting up the server instance. If you have the JBoss Setup Wizard then you can skip to section Setup a Debug Session and continue from there. This wizard will setup JBoss running in default, tomcat or catalina. The wizard can be found on code central id#17446. This document will setup the JBoss server to run catalina.

7 For this discussion, the JBoss distribution is unzipped to c:jboss2.4.4 and the environment variable ANT_HOME is     set to


7 This will allow you run ant from the command line

7 Unzip the In this case the directory is


7 Startup JBuilder and create a new project called jbsetup

7 Click on the Finish button.

7 What we want to do is define a new library, which contains the required jar files and paths to run the server and compile our ejbs and client applications. In this case, we will be adding all the Jboss and tomcat jar files.

7 Next select from the projects menu Project/Project Properties/Required Libraries Add and New. Type in JBoss-server for the library name. DO NOT add anything at this point, we will open the file in WordPad and add the libraries we need.


7 Click OK and you should have this screen

7 Now go to the .jbuilder6 directory, note there is a "." In front of this directory.

7 This file on my machine is located at

           C:Documents and Settingsbthompson.BRENTW2KHOME.jbuilder6

7 In explorer, go to this directory and open up the file you just created called jboss-server.library. Open this file in WordPad. You should have the following:

<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder Library Definition File-->

7 Cut and paste the following into this file, overwriting the previous text. Remember to change to the correct path on your system. (All that should change is the c:/jboss2.4.4 part)

<?xml version="1.0" encoding="UTF-8"?>
<!--JBuilder Library Definition File-->

7 Save the file.

7 To verify select project properties/required libraries, select Add and under User Home select jboss-server, then click on the Edit button and you should see

7 Select Ok then Ok again and you will be back to the project view in Jbuilder.

7 Open Project -> Project Properties -> Run and select

Main Class: org.jboss.Main

7 Copy and past this under VM Parameter:

-Dtomcat.home=C:JBoss2.4.4catalina -Duser.dir=C:JBoss2.4.4jbossbin -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl

7 Under Application Parameter:

7 We now have created a project called jbsetup, the required libraries and runtime parameters. Our next step is two modify some of the configuration parameters in the JBoss conf files.

Modify and jboss.jcml

7 There are two was to configure JBuilder to run JBoss.

7 One is to set under Project/Project Properties/Paths the working directory as:

                    C:/JBoss2.4.4/jboss/bin for jbsetup.jpx

7 Then you can leave the conf files as is


7 If you want to use the existing projects working directory.

7 Go to file

7 In this file change the line


7 To


7 You also want to go to the Auto Deployment section in file C:JBoss2.4.4jbossconfcatalinajboss.jmcl and add in

7 C:/JBoss2.4.4/jboss/deploy,C:/JBoss2.4.4/jboss/deploy/lib

7 where you see ../deploy,..deploy/lib

<!-- Auto deployment -->
<!--=============================================================== -->
<mbean code="org.jboss.ejb.AutoDeployer" name="EJB:service=AutoDeployer">
<attribute name="Deployers">
<attribute name="URLs">C:/JBoss2.4.4/jboss/deploy,C:/JBoss2.4.4/jboss/deploy/lib</attribute>

7 We have to modify this file because the relative paths are now based on your project, not the JBoss installation.

7 Now what we can do is start jboss, select Debug and you should see a Main tab at the bottom left hand corner of the IDE, with the jboss server process initializing.

7 It should be error free. If there are any errors, go back over the config files and check that you paths are correct.

7 The next step is to unzip the javaopen example, create a new project,specifying our previous project as the default.

Setup a Debug Session

7 Unzip the file to your disk. We will use

c:javaexamples our directory for the example files.

7 Your directory should now read


7 Stop the JBoss instance from running and select Project/Project Properties and add the source path to the jbsetup project and click OK and restart the debug session.

7 This will allow us to debug our EJB code.

7 From JBuilder select file/New Project input the following:

7 Click on next and you should have the following, then under required libraries click on add

7 Under required libraries we should see

7 Here we want to add a resource file that comes with our example, select it under required libraries. Click Add/ the New and type in resource for the name, then select the following file.

7 Click OK

7 We should now see our new project, with the JBoss server instance still running.

7 We want to add our java files to the project. To do this right click on the project pane and select Add File/packages.

7 Select Ok

7 Right click on examples.jpx and select rebuild.

7 Now open Project -> Project Properties -> Run and select InterestClient.

7 To recap what we have done up to now. We have created a project called examples which contains our client code and includes the jboss-server library. We have compiled all our client and EJB code from within Jbuilder. What we want to do now, is use ant to create a EJB JBoss jar file that we can deploy, then debug the code from within JBuilder.

7 Open a cmd window and cd to the jboss example files.

                    cd c:javaexamplesbuild

7 At the prompt type

                    c:> ant intro-interest-jar

7 The jar file we just create can be found in C:javaexamplesbuild-examplesinterestinterest.jar

7 Copy this jar file to C:jboss2.4.4jbossdeploy

7 We should now see in the JBuilder message view just above the Main tab the following :

7 JBoss has deployed our interest EJB.

7 Select a break point.

7 and here

7 Select debug and we should see the following

7 Stepping through, press F8 we will end up in our Main instance stopping at the break point we set in the Interest Bean

7 We can now step through our client app and EJBs. If you want to step through JBosss code then you will have to set the appropriate source paths to the JBoss source.

Server Response from: ETNASC03