Chapter 8. Development Tools and IDE Integration

Table of Contents

Integrating JBuilder 4.0 Foundation with JBoss for source level debugging
How to Run and Debug EJBs using jBoss 2.2.2 inside of Visual Age for Java version 3.5 (patch 2)
Integrating NetBeans/Forte for Java Community Edition with JBoss for source level debugging
Using Verifier in Ant
How to generate Enterprise Java Beans with EJBDoclet (XDoclet)

Integrating JBuilder 4.0 Foundation with JBoss for source level debugging

Author:John P. Coffey <>

Install the JBoss Server

For the purpose of this howto, I installed the JBossTomcat release version 2.2.1 into d:\JBoss-2.2.1_Tomcat-3.2.1. Download it from and select the binary link from the page. Don't worry about downloading a binary package, when all you want is the source code; the binary package also contains the source code used for building.

Create a JBuilder 4.0 Project

While setting up an EJB project the typical entry level screen Project/Properties should look like:

Create a JBoss-Server library

This is the most difficult aspect of the setup to get correct, however once completed it does not need to be changed so you can setup multiple ejb projects and reuse this library thanks to the folks at Borland.

To do this launch the Project/ProjectProperties/RequiredLibraries/Add... dialog

Add the following library entries to the JBoss-Server classpath (the order is crucual here). Pay specific attention to the log and tmp folders, faulure to put these in the Library class path will cause the classloader to spit out error messages, the most confusing of which is that / or / files could not be located. This is because the folders containing these files need to be in the classpath and the class loader complains.


In the source tab for the JBoss-Server library point to /$JBOSS_TOMCAT_HOME/jboss/src. This is how JBuilder resolves where to find the source for stepping through the code. Without this step typically you will be able to step through the code but the will appear as Main.class.

As per the diagram figure below, set the main class entry point to 'org.jboss.Main'. This is where the JBoss server code starts up. Make sure that you set the working directory is set to $JBOSS_TOMCAT_HOME/jboss/bin in the paths tab.

Cut and paste the following line and place it into the 'vm parameters' entry field (Project/Properties/Run)

-classic -Dtomcat.home=D:\$JBOSS_TOMCAT_HOME\tomcat -Duser.dir=D:\$JBOSS_TOMCAT_HOME\jboss\bin

The starup argument should be left blank with the above setting. If you want to run with the integrated tomcat you can put tomcat as the argument, however beware that you MAY need to replace the /$JBOSS_TOMCAT_HOME/jboss/conf/default with /$JBOSS_TOMCAT_HOME/jboss/conf/tomcat

If the above steps have been done correctly, open up JBoss-Server.library, this is located in the folder you specified when creating the library. Typically this is C:\Documents and Settings\<nt_username>\.jbuilder4 or home directory on Linux. Do NOT edit this file, I found several problems manually editing this file and I am unsure why but I got several instances of resource not found exceptions afterwards. If in doubt don't touch it!

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

A note about the initial file directory specifier. I have seen this a couple of ways, if you have multiple hard drives with the home on C and the JBoss on D for example you will see 'D%|/' in place of / or alternatively you may see a relative directory such as ../../JBoss-2.2.1....

Bypass the hanging InstantDB embedded database

I found that loading instant DB within its minnerva pool manager occasionally causes the debugger to hang (on different setups), to work around this, I made the following modifications to config/tomcat and also config/default (it depends on the model you wish to start up JBoss in)

<!-- JDBC @JC org.enhydra.instantdb.jdbc.idbDriver  removed from list of drivers -->
<mbean code="org.jboss.jdbc.JdbcProvider"
   <!-- <attribute name="Drivers">org.hsql.jdbcDriver,
    org.enhydra.instantdb.jdbc.idbDriver</attribute> HANGS DRIVER -->
   <attribute name="Drivers">org.hsql.jdbcDriver</attribute>

and comment out the minnerva pool definitions associated with InstantDB

  <mbean code="org.jboss.jdbc.XADataSourceLoader" 
    <attribute name="PoolName">InstantDB</attribute>
    <attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
    <attribute name="Properties"></attribute>
    <attribute name="URL">jdbc:idb:../conf/default/</attribute>
    <attribute name="GCMinIdleTime">1200000</attribute>
    <attribute name="JDBCUser" />
    <attribute name="MaxSize">10</attribute>
    <attribute name="Password" />
    <attribute name="GCEnabled">false</attribute>
    <attribute name="InvalidateOnError">false</attribute>
    <attribute name="TimestampUsed">false</attribute>
    <attribute name="Blocking">true</attribute>
    <attribute name="GCInterval">120000</attribute>
    <attribute name="IdleTimeout">1800000</attribute>
    <attribute name="IdleTimeoutEnabled">false</attribute>
    <attribute name="LoggingEnabled">false</attribute>
    <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
    <attribute name="MinSize">0</attribute>

Sprinkle breakpoints throughout your EJB and or Client Code

Firstly it is necessary to put breakpoints in your ejb's. As outlined previously project settings should point to the source of your beans. Open up a typical bean implementation and place breakpoints whereever desired.

Start the JBoss server

Using the IDE, select run / start debugger (shift + f9). If you want to see your beans being instantiated by the deployer, place breakpoints on the bean constructors (if you specified them) You will not need to have a client running to exercise this functionality.

Deploy the Beans

copy of drag/drop (for windoze fans) the ejb jar file containing the ejb-jar.xml and jboss.xml (optional) to the deploy folder. If you have set breakpoints in stateless session ejb's these should cause the debugger to stop in your code! Hurrah!

Start the Client Test Application

If you include a client test code in your project you can debug this also (even though the project's main execution class is specified as 'org.jboss.Main'. To do this, select the test client class from the project class pane and from the popup context meny, select debug. You should be aware though that this debug session will run from the $JBOSS_TOMCAST_HOME/jboss/bin directory since this is where we set the ejb project to execute from (see above). If all goes well, you will have 2 running tabs in the messages window, one of these will be called Main (this is the JBoss server process and this is where you can single step through EJB code while the other is the test client. One thing though, the timeouts are somewhat short so if you spend too much time in a method within the EJB you may find that transactions are rolled back.

If anyone has suggestions of feedback please let me know, I can be contacted via email at

Наши друзья