Integrating JBuilder 6 Personal Edition with JBoss 2.4.4_Tomcat-4.0.1

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

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

C:jakarta-ant-1.4

7

This will allow you run ant from the command line

7

Unzip the documentation-example.zip. In this case the directory
is

C:javaexamples

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"?>
<library>
<!--JBuilder Library Definition File-->
<fullname>jboss-server</fullname>
</library>

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 documentation-example.zip file to your disk. We will
use

c:javaexamples our directory for the example files.

7

Your directory should now read

c:javaexamplesbuild
org
resources

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.