Chapter 11 Creating CORBA Java Components


Debug Java components

You can debug Java components that are executing in EAServer.

Before you start

Debugging Java components requires the following:

Steps to debug an executing component

Steps Debugging Java components

  1. Make sure that you have followed the requirements in "Before you start".
  2. Make sure no one else is debugging components using the same server. The server-side debugger supports only one remote-debugger connection at a time.
  3. Run your debugging client such as jdb or PowerJ. The debugger JDK version must match the server's JDK version.
  4. If using JDK 1.2 You must specify the debugger password to debug code executing in another process:

    1. Find the remote-debugger password in the server's console window. For example, the password is k53js in the output reproduced below:
      Agent Password=k53js
      


      You will need this password to connect to EAServer with your debugger.
    2. Start your debugger and connect to EAServer. For example, with jdb:
      jdb -host localhost -password k53js
      

  5. If using JDK 1.3 You must specify the server's host name and JPDA port, the JDPA port is specified on the JDPA tab in the server properties window. For example, using jdb:
    jdb -attach myhost:8000 
    

  6. Once connected, you can specify breakpoints for the debugger to stop at in your component implementation. Set the breakpoint before running any client applications that will exercise the target line of code. For example (the following must be entered on one line):
    stop at Sample.SVU.javaComp.
    Enrollment_Java.Enrollment_JavaImpl:74
    
  7. Run a client application that will invoke the target component code. For example, to debug the CreateStudentRecord method in the Java_Enrollment component, run the SVU Java example client in your Web browser and create a new student record on the login screen. In the debugger, you should see some indication that the breakpoint has been reached.

    Note   You may need to change the debugger's active thread before the component breakpoint is indicated. EAServer runs each Java component instance in a separate Java thread. The component thread must be the active debugger thread in order to step through the component's code. In jdb, use the threads command to list the executing threads. You can then use the thread command to switch to the thread that is running the component.
  8. Once the breakpoint is tripped, you can step through the code, inspect fields and variables, and so forth. For example, in jdb:
    Thread-21[1] where 6 
    


      [1] Sample.SVU.javaComp.Enrollment_Java.Enrollment_JavaImpl.
    createStudentRecord (Enrollment_JavaImpl:74)
    


    Thread-21[1] print student_id 
    


    student_id = 333-33-3333
    


    Thread-21[1] cont 
    

Debugging class loading and unloading problems

Jaguar Manager provides the following server properties to log information about Java class loading and unloading. You can set these properties on the All Properties tab in the Server Properties dialog box:

Property Description
com.sybase.jaguar.server.jvm.verbose When this property is set to true , the server logs all Java classes that are loaded and the location where each class file was read.
com.sybase.jaguar.server.jvm.verboseGC When this property is set to true , the server logs information when memory is freed by the Java garbage collector.
com.sybase.jaguar.server.classloader.debug When this property is set to true , the server logs information about loading classes from custom class lists defined for the component, package, application, or server.

The default for all of these properties is false .

 


Copyright © 2002 Sybase, Inc. All rights reserved.