Debugging remote OC4J
This is a short howto for debugging Java code running in a remote OC4J in OAS 10. It only presents the basics, for more details refer to the JavaTM Platform Debugger Architecture.
To enable debugging, edit
$ORACLE_HOME/opmn/conf/opmn.xml. Find the
process-type tag for the OC4J container you want, for example oc4j_soa. Find the next
data tag with id "java-options". Add the following:
Reload opmn and restart the process, for example:
opmnctl reload opmnctl restartproc gid=oc4j_soa
The JVM will suspend on startup and wait for a debugger to connect. To avoid that use
suspend=n, but it is often useful to debug code that runs only during startup.
Time to connect with a debugger.
In jDeveloper select "Project Properties" for a Java project, find "Run/Debug" in the dialog and create a new or edit an existing configuration. In the tree view for the configuration, select "Remote". Select protocol "Attach to JPDA" and enter the host name for the application server. The port should match the address in the runjdwp option.
In Eclipse, select "Run/Debug Configurations...", select "Remote Java Application" and create a new configuration. Connection type should be "Standard (Socket Attach)" which is the default. Simply fill in the correct host and port.