Tracing and debugging a Java client
and Business Object (Windows NT/2000)
Objective
The
objective of this sample is to trace and debug a distributed application in which the
client code and business object are written in Java. Both are installed 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:

Description
In this exercise, you will complete these steps:
- Start Object Level Trace.
- Run your application to produce a trace.
- Set a breakpoint on the business object.
- Prepare for tracing and debugging.
- Rerun your sample for tracing and debugging.
- Debug the server method.
- Step from server to client code for tracing and debugging.
- Disable the breakpoint and run the application to completion.
Sample instructions
Follow these steps to perform the tracing and debugging for this scenario:
- To start Object Level Trace on your Windows NT/2000 system, type olt in a
command window . OLT starts. Make sure that Trace only is selected for Execution
mode for Default settings in the OLT Viewer window. If you have
to change the setting, click Apply.
- Run your application to produce a trace.
- From a command prompt, change to the directory where you compiled the Java client
version of the Policy sample
- Enter the following command:
java
-Dcom.ibm.CORBA.EnableApplicationOLT=true
-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:\WebSphere\AppServer\lib\dertrjrt.jar;%CLASSPATH%"
-Xbootclasspath/a:"%JAVA_HOME%\lib\tools.jar;D:\WebSphere\AppServer\lib\derdbpw.jar"
PolicyApp
where:
<OLT_Server_Host> is the fully qualified name or
TCP/IP address of the machine running your OLT server
<OLT_Server_Port> is the port where the OLT server listens for
connecting OLT clients (default 2102)
- A trace is created, showing the calls from your client to the Policy and PolicyHome
objects on the server, similar to the following:

- Set a breakpoint in the trace.
- In the trace, select the server event that represents the getpremium method.
- Select the event, right-click, and select Add to Method Breakpoint List.
- Prepare for tracing and debugging.
- From the OLT Viewer's Options menu, deselect Step-by-step
Debugging Mode.
- In the OLT Viewer's Client Controller page, select Trace and debug for Execution
mode and click Apply.
- Rerun the sample for tracing and debugging.
From a command prompt, change to the directory where you compiled the Java client version
of the Policy sample.
- Enter the following command:
JDK 1.2.2+JPDA
java -Xdebug -Xnoagent Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=<JVM_port>
-Djava.compiler=NONE
-Xbootclasspath/a:"<WebSphere_jdk>\lib\tools.jar;<WebSphere>\lib\derdbpw.jar"
-Denv.class.path=%DEBUG_CP%
-Dcom.ibm.debug.jdwpport=<JVM_port>
-Dcom.ibm.CORBA.requestTimeout=0
-Dcom.ibm.CORBA.EnableApplicationOLT=true
-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:\WebSphere\AppServer\lib\dertrjrt.jar;%CLASSPATH%"
-Xbootclasspath/a:"%JAVA_HOME%\lib\tools.jar;D:\WebSphere\AppServer\lib\derdbpw.jar"
PolicyApp
Where:
- <WebSphere_jdk> is the where the WebSphere JDK is
installed, for example, c:\WebSphere\AppServer\java.
- <WebSphere> is the where the WebSphere AppServer is
installed.
- %DEBUG_CP% has the location of the Java source code.
- <OLT_Server_Host> is the fully qualified name or TCP/IP address
of the machine running your OLT server
- <OLT_Server_Port> is the port where the OLT server listens for
connecting OLT clients. The default is 2102.
- <JVM_port> is the port for the JVM. It is a free port
number.
If you are using other JDK levels, see JDK 1.1.x and JDK 1.3.x for the appropriate java command.
- Debug server method.
- The program halts at your breakpoint and the debugger prompts for the source file
location. Follow instructions to specify the source file.
- The debugger opens and steps into the getpremium method on the server:

- Step from server to client code for tracing and debugging.
- Click Step over once. This creates another debugger page for the
client, and shows you the client stub code, at the step immediately past the call to the
getpremium method:

- On the client debugger toolbar, click Step return once. The following
client code is shown:

- Disable the breakpoint and run the application to completion.
- In the OLT window, Select Breakpoints > List method breakpoints. A
dialog box opens.
From the Available method breakpoints list, select the getpremium breakpoint and click Disable.
- In the Debugger window, click Run. The application runs to completion.
Important Note:
While running your application, do not close the debugger window you are using to debug
server code. Doing so shuts down the application server (this is a Windows NT/2000 limitation).
When you finish debugging, stop your application server using System Manager, then close
the OLT window.

Component Broker Object Level Trace examples
OLT Overview