You can debug Java components that are executing in EAServer.
Debugging Java components requires the following:
If using the default server configuration, the debug version of the server must be running. “Starting the server” in the EAServer System Administration Guide describes how to start the debug server. If running JDK 1.3 or later, you must specify a port for debugger socket connections on the JDPA tab in the EAServer Manager Server Properties dialog box. Restart the server in debug mode for the change to take affect.
To enable debugging in the production server, configure the EAServer Manager server properties. Display the Advanced tab, and modify the property com.sybase.jaguar.server.jvm.options. Append the following to the existing value, all on one line. Change port to and unused port number on your server machine, to specify the port number for JDPA debugger connections:
,-Xdebug, '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=port', '-DJaguarServletDebugging=true','-Djava.compiler=NONE','-Xnoagent'
You need a Java debugger that supports remote debugging and is compatible with the JDK version used by the host server, such as JBuilder or the JDK jdb tool.
Component class files must include symbol information
for fields and local variables. If you are compiling with javac,
components must be compiled with the -g
option.
If you use a Java IDE, set the equivalent option to build debuggable
class files.
Source files must be available to the debugger. The required location for source files depends on your debugging tool:
For jdb, source files must be on the server host, in the directory from which the corresponding class file is loaded.
JBuilder uses local source files from the project directory.
For other IDE debuggers, consult the IDE documentation for source file requirements when you are debugging remotely.
Debugging Java components
Make sure that you have followed the requirements in “Before you start”.
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.
Run your debugger. The debugger JDK version must match the server’s JDK version. 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 to connect to a server running on machine “myhost,” using port 11000 for JPDA connections:
jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=11000
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
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.
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.
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
EAServer Manager provides the following server properties to log information about Java class loading and unloading. You can set these properties on the Advanced tab in the Server Properties dialog box:
Property |
Description |
---|---|
com.sybase.jaguar.server.jvm.verbose |
When this property is set to |
com.sybase.jaguar.server.jvm.verboseGC |
When this property is set to |
com.sybase.jaguar.server.classloader.debug |
When this property is set to |
The default for all of these properties is false
.
Copyright © 2005. Sybase Inc. All rights reserved. |