Start the debug agent for the JVM using a user-supplied or default port number. Use sp_jreconfig with these configuration parameters to enable debugging, choose a port number, and specify whether the JVM is immediately suspended:
pca_jvm_java_dbg_agent_port – enables or disables debugging and establishes the port number on which the debug agent in the JVM listens. If you enable this parameter, the JVM starts with the debug agent running in a manner that allows a remote debugger to attach. By default, the debug agent listens on port 8000. To enable the debug agent and allow debugging using the default port, enter:
sp_jreconfig "enable", "pca_jvm_java_dbg_agent_port"
To use a different port, change the port number prior to starting the JVM. Once the JVM is started with the debug agent running, the debug agent listens on that port until the JVM shuts down. To enable debugging and change the port on which the debug agent listens, enter:
sp_jreconfig "update", "pca_jvm_java_dbg_agent_port", new_port_number
pca_jvm_java_dbg_agent_suspend – controls whether the JVM suspends on startup when the debug agent is running. By default, pca_jvm_java_dbg_agent_suspend is disabled.
When pca_jvm_java_dbg_agent_suspend is enabled, no Java method can execute until a debugger is attached and the JVM is restarted. Suspending the JVM lets you examine the early initialization of the JVM before any classes are loaded. In general, suspending the JVM is not necessary for debugging user classes.
To enable pca_jvm_java_dbg_agent_suspend, enter:
sp_jreconfig "enable", "pca_jvm_java_dbg_agent_suspend"
Use pca_jvm_java_dbg_agent_suspend with
caution. Enabling pca_jvm_java_dbg_agent_suspend causes
the JVM to suspend and all Adaptive Server Java tasks to wait until
you attach and instruct the JVM to continue via the debugger. Sybase
recommends that you start the JVM and run a simple Java command
to allow you to attach the debugger rather than enabling pca_jvm_java_dbg_agent_suspend.
This allows the JVM to boot, and lets you attach the debugger before
executing the class that is to be debugged.
Once the configuration values enabling the debug agent in the JVM are set, the next time the JVM is started the debug agent is available. To disable the debug agent the debug agent, disable the configuration parameters and restart the JVM (the agent cannot be turned off once the JVM has started with the agent running).
Do not run the debug agent by default. When the debug
agent is running, any debug application with network access to the
host can potentially connect with the JVM and gain access to object
internal data.