Here are some basic instructions for reproducing the development environment I used to get NetBeans debugging working with Orion. The instructions are Windows-specific, but the conversion to UNIX/Linux should not be that difficult:

Required Components:

JDK 1.2.2
NetBeans (Latest stable build)
JPDA (Java Platform Debugging Architecture)
Orion (Latest version)
 

Installing:
(remember that anytime you change envionment variables in Windows, any command prompts that are open before the changes are made will not reflect the changes, you should close them and open new ones to test changes)

1. Install JDK 1.2.2 to d:\jdk1.2.2

After installation check/clean up your PATH and CLASSPATH environment variables. Remove anything that points to any other JVM. CLASSPATH is not really needed by JDK 1.2.2, so you can probably remove any entries safely. And make absolutely sure there are no entries like <another JVM>\bin in your path.

Add d:\jdk1.2.2\bin to your PATH variable.

2. Install JPDA to d:\jpda

For JPDA to work, you must add d:\jpda\bin to your PATH variable

3. Install JPDA as a Java Extension

Copy d:\jpda\lib\jpda.jar to d:\jdk1.2.2\jre\lib\ext

4. Install NetBeans to d:\NetBeans

Unpack the .zip file to d:\, this will autmatically create the d:\NetBeans folder.

(at this point NetBeans is configured to allow debugging of remote JVMs)

5. Install Orion to d:\orion

If you already have orion installed, there is no need to re-install.
 

7. Create a batch file that starts Orion with the JPDA options turned on.

I created d:\orion\oriondebug.bat with the following contents:

set CLASSPATH=%CLASSPATH%;.\orion.jar;.\ejb.jar;.\jndi.jar;.\lib\tools.jar;d:\jpda\lib\jpda.jar

java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -jar orion.jar

(This will run orion in a debug-enabled JVM that is listening on port 8000 for debug connections. The JVM will wait untill a connection is made to continue execution)

8. Run NetBeans and connect the debugger to the Orion JVM.

Start Orion with the batch file described above.

Run NetBeans by double-clicking d:\NetBeans\bin\runide.exe.

After netbeans comes up, select "Connect..." from the "Debug" menu. If JPDA is installed properly you should see "Default Debugger (JPDA)" in the dialog under "Connector type". If so...

Select "SocketAttach" for the connector, and enter "8000" in the "port" field.

Click "OK".

If you don't get an error, you have successfully connected the debugger to the Orion JVM. This will allow the JVM to continue executing, and Orion will initialize.

Have a source file for one of the Orion components (servlet, EJB, etc.) open, with a breakpoint set. (The source code for the class(es) you want to debug must be in the NetBeans classpath (i.e. "Filesystem"), otherwise the debugger will halt at the breakpoint(s), but you will not be able to trace through the source.) As soon as that code executes, the debugger will halt execution, allowing you to trace through it, watch variables, etc.

If you are using a browser to invoke the server-side code, you will want to use IE. Try it with Netscape and you will understand why... (the CPU gets pegged and everything slows to a crawl while Netscape blocks waiting for data).

Hope this helps.
 

Reply via email to