Home > SOA Suite > Debugging remote OC4J

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:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4000

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.

Categories: SOA Suite
  1. 2014-03-18 at 01:17

    What if i have multple jvms configured? They all try to use the same port and fail, is there a workaround.

    • 2014-03-18 at 14:03

      Replace address=4000 with 4001 or some other value that is free.

      • 2014-03-18 at 15:32

        i mean multiple jvms for the same process type…

    • 2014-03-18 at 19:47

      Right, should have guessed. Simply leave out the address option. All jvm:s will pick random ports and print them to standard out at startup. A bit inconvenient as you need to find the ports manually but it should work!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: