Tracing and debugging a Java client from startup (Windows NT/2000)

Objective
The following information applies to Windows.The objective of this sample is to debug Java client code from startup, then step into the C++ server code on Windows NT/2000.

Before you begin
You must complete the steps to compile and install the Policy sample for Windows NT/2000, including the Java client application (as explained in the Preparing for the OLT tutorials).

For this exercise, a single Windows NT/2000 machine is running OLT, the debugger, and your client and server applications, as follows:

npoolt1a.gif (2989 bytes)

Description
In this exercise, you will complete these steps:

  1. Start Object Level Trace.
  2. Start the Java client in the debugger.
  3. Set a breakpoint on the client.
  4. Step through a client call to the server and debug the server method.
  5. Step back from server method into client code.
  6. Run the application to completion.

Sample instructions
Follow these steps to perform the tracing and debugging for this scenario:

  1. Start Object Level Trace on your Windows NT/2000 system.
    1. Type olt in a command window . OLT starts.
    2. In the OLT Viewer's Client Controller page, select Trace and debug for Execution mode for Default settings and click Apply.
    3. From the OLT Viewer's Options menu, deselect Step-by-step Debugging Mode.
  2. Start the Java client in the debugger.
    1. From a command prompt, change to the directory where you compiled the Java version of the Policy sample.
    2. Enter the following command, which starts both the policy application and the Java debugger:

      JDK 1.2.2+JDPA

idebug -qlang=java
-qjvmargs="-Xdebug -Xnoagent -Xrunjdwp:transport-dt_socket,server=y,suspend=n,address=<JVM_port>
-Djava.compiler=NONE -Xbootclasspath/a:"<jdk_home>\lib\tools.jar;<WebSphereEE>\lib\derdbpw.jar" -Dcom.ibm.debug.jdwpport=<JVM port>
-Dcom.ibm.CORBA.EnableApplicationOLT=true -Dcom.ibm.CORBA.requestTimeout=0 -Dcom.ibm.CORBA.OLTApplicationHost=<OLT_Server_Host> -Dcom.ibm.CORBA.OLTApplicationPort=<OLT_Server_Port> -DOLTClient=true -classpath d:\cbroker\samples\InstallVerification\ProgrammingModel\ BusinessObjects\Policy\Working\NT\TRACE_DEBUG\jcb\jcbPolicyC.jar; d:\cbroker\lib\somojor.zip;D:\cbroker\lib\dertrjrt.jar;%CLASSPATH% -Xbootclasspath/a:"\lib\tools.jar" -Dcom.ibm.debug.jdwpport=" PolicyApp

where:

The Java debugger opens to the first executable line in the Policy client application.

If you are using other JDK levels, see JDK 1.1.x and JDK 1.3.x for the appropriate idebug command.

  1. Set a breakpoint on the client.
    Scroll to the following highlighted line and set a breakpoint by double-clicking on that line number:

    npnojj1a.gif (3933 bytes)

  2. Step through a client call to the server and debug the server method.
    1. On the debugger toolbar, click Step into. This places you in the premium method on the client:

      npnojj2a.gif (4851 bytes)

    2. Set a breakpoint two lines down on this line of code:
      org.omg.CORBA.portable.OutputStream

      by double-clicking on the line number in the prefix area. Then click Run to stop at the breakpoint.

    3. On the debugger toolbar, click Step debug. The debugger follows the client request to the server. A new debugger page opens and places you in the server code, at the premium method of the selected object:

      npnojj3a.gif (3695 bytes)

  3. Step back from server method into client code.
    On the debugger toolbar, click Step over twice to go back to the next executable line on the client, which is highlighted, as follows:

    npnojj4a.gif (4791 bytes)

  4. On the client debugger toolbar, click Run. When you see the following dialog box saying that the PolicyApp has terminated, click OK. The trace is now complete.

Important Note: While running your application, do not close the debugger window that you are using to debug server code. Doing so shuts down your application server. When you finish debugging, stop your application server using System Manager, then close the OLT window.

ngrelr.gif (548 bytes)
Component Broker Object Level Trace examples
OLT Overview