InfoCenter Home >
6: Administer applications >
StockQuote tutorial: Using Debugger and OLT
6.7.sq: StockQuote tutorial: Using Debugger and OLT
StockQuote is one of the samples that ships with IBM WebSphere Application
Server. It is installed if, during WebSphere Application Server
installation, you choose to install the Samples. This tutorial demonstrates how
to use the IBM Distributed Debugger and Object Level Trace (OLT) on the StockQuote
sample, referring to screen captures from the administrative console (WebSphere
Administrative Console) used with the Application Server Advanced Single
Server Edition.
Let's begin.
- Start the Administrative Console:

- Select IBM Debug and OLT in the topology view on the left
side of the console for the default server on your node:

- This will cause the IBM Distributed Debugger and Object Level Trace
Settings page to display in the right-hand frame of the browser:

Select the Enable Object Level Trace and Enable IBM
Distributed Debugger checkboxes. In the Host Name field, specify the OLT Host Name by entering the name of
the machine where you will be running the OLT tool. The OLT Port should not be
changed from its default of 2102, unless there is a port conflict (see the Note
below). The entry in the Source Path field indicates to the Debugger where
servlet
source files, EJB source files, and JSP files can be found. Use semicolons to separate all
entries on the Source Path. For this sample, add the following to the source
path:
<WAS_ROOT>\installedApps\Samples.ear\Samples.war\StockQuote;<WAS_ROOT>\installedApps\Samples.ear\Samples.war\WEB-INF\classes\WebSphereSamples\StockQuote
where WAS_ROOT is where WebSphere Application Server is installed
(eg. c:\WebSphere\AppServer).
Click OK when you are finished.
- To save your configuration, click Save and then click OK in the
Save Configuration frame. At this
point, you must restart the application server in order to pick up your
changes:

- Once you have restarted the application server, start OLT by issuing
the olt command at a command prompt. You will then see the following screen:

Ensure that the Execution mode is set to Trace and debug. If it is not, click the
drop-down list and select it. In the Debugger hostname field, specify the name of the machine
where the debugger tool is located. Assuming for this example that
the Debugger is installed locally, enter the host name of the machine on which
you are working. Keep the Debugger TCP/IP port set to 8001 (change it only if
port 8001 is already in use on your machine). Click Apply.
- Invoke the IBM WebSphere Application Server Samples and select the StockQuote sample.
You will see the following in your web
browser:

-
Click Run this Sample. OLT will trace the initial calls
to the StockQuote servlet and JSP:

-
Your browser should then display the following:

-
Let's enable step-by-step debugging now.

-
In the browser, enter IBM in the Stock Symbol field and
then click Submit. Because you selected step-by-step debugging mode, you will be asked if you
want to step into every method that can be debugged. The first method is
the doPost method of StockQuoteServlet. The following dialog box will be displayed:

-
Highlight the doPost method and Click OK. This will cause the debugger to attach and suspend in the first executable line of the
StockQuoteServlet doPost method:

-
You can now choose to step over methods, step into others, or run the
program. Click Run in the Debugger toolbar.
Because OLT is in Step-by-Step mode, when it encounters the next method that
can be debugged, it will ask you again (via the Method breakpoints dialog box)
if you would like to step into the method: 
Let's step into the JSP, highlight the _jspService method in the
Method Breakpoints dialog box, and click OK. Or, if you wanted to skip
breaking into this method, click Cancel in the Method
Breakpoints dialog box.
-
The debugger will enter the JSP code, displaying the following:

-
You can now choose to step over, step debug, run, and so on. If you
click Run, then StockQuote should run to completion.
Note, your browser may have timed out by this time. The Troubleshooting
section of the OLT/Debugger documentation describes how to increase the
browser timeout.
Note:
If you modify the Port in the IBM Distributed Debugger and
Object Level Trace settings frame to a port other than 2102, you must start
OLT and modify the OLT Server TCP/IP port
accordingly. The OLT Server TCP/IP port is set in the Browser Preferences
dialog box (accessed by selecting File > Preferences from
the OLT menu bar and then selecting the OLT node). If there is a port conflict and you
are unable to start OLT, go to the %userprofile%\DbgProf directory and modify the
OLT_TRC_SRVAPP_PORT in the dertrenv.dat file accordingly.
|
|