Developing Apama Applications > Using Apama Studio > Debugging Apama Java Applications > Preparing the correlator for remote debugging
Preparing the correlator for remote debugging
Launching the correlator with the –j option enables the Java Virtual Machine (JVM) as a subprocess in correlator execution. When launching an Apama project in Apama Studio, specification of the -j option launches the correlator and launches its JVM as an external process. Consequently, you must enable a socket connection to the JVM so that you can connect the Apama Studio debugger to it. This also applies to launching a correlator through any other means.
Enable debugging in the correlator JVM by specifying the Java options for the correlator component in the launch configuration. The Java Debug Wire Protocol (JDWP) is the protocol used for communication between a debugger and the Java virtual machine (VM) that it debugs. Sun's VM implementations require command line options to load the JDWP agent for debugging. JDWP is optional; it might not be available in some implementations of the Java™ 2 SDK. The existence of JDWP can allow the same debugger to work.
From Java 5.0 (or 1.5.0) onwards, specify the -agentlib:jdwp option to load and specify options to the JDWP agent. For Java releases prior to 5.0, the -Xdebug and -Xrunjdwp options are used. (The 5.0 implementation also supports the -Xdebug and -Xrunjdwp options but the newer -agentlib:jdwp option is preferable as the JDWP agent in 5.0 uses the JVMTI interface to the VM rather than the older JVMDI interface.) Specify this option in the correlator component in your launch configuration or when launching the correlator independently:
-J -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
This tells the JVM to use a socket transport on port 8787. You can change this at will and use your own options. For more Java debugging/agent options see:
http://Java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#Invocation
To launch the correlator with Java and remote debugging enabled, you can use a command line or Apama Studio.
On the command line, invoke the correlator with the following arguments:
correlator -l license.txt -j -J
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
In Apama Studio, invoke the correlator as follows:
1. From the main Apama Studio menubar, select Run > Run Configurations .
2. Click the Components tab.
3. Select the correlator you want to start and click Edit.
4. Enter the following in the Extra command line arguments field:
-J -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
5. Select OK and then Run to start the correlator.
The correlator is now enabled for Java debugging. The next section discusses how to connect to the correlator with the Apama Studio debugger.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.