Debug a custom Java adapter (that was built using the adapter toolkit) by starting
it in debug mode and using an Integrated Development Environment (IDE) that supports remote
debugging, such as Eclipse.
Prerequisites
- Install Java Runtime Environment (JRE) version 1.6 or 1.7.
- If debugging the adapter using Eclipse, install Eclipse version 3.7 (Indigo) or
higher.
Task
The steps below describe how to debug a custom or an example adapter using an Eclipse
IDE. You can use similar steps to debug a custom adapter using another IDE that supports
remote debugging.
- Choose an example adapter from
%ESP_HOME%\adapters\framework\examples or another adapter of
your choice.
- Compile the transporter and formatter module Java files to .class files (debug
version) and compress them to .jar files using the jar.exe
tool.
- Copy these debug files to the
%ESP_HOME%\adapters\framework\libj directory.
- Back up the modulesdefine.xml file in the
$ESP_HOME/adapters/framework/config directory.
- (Perform only if debugging an example adapter) Prepare the adapter configuration
file:
- Copy the
$ESP_HOME/adapters/framework/examples/modulesdefine.xml
file to the $ESP_HOME/adapters/framework/config.
- Edit the set_example_env.bat or
set_example_env.sh files and the adapter configuration
file for the example adapter. Specify values for the username and password
elements in the example adapter configuration file.
- Start the ESP cluster node:
Windows
cd %ESP_HOME%\cluster\nodes\<nodename>
%ESP_HOME%\bin\esp_server --cluster-node <nodename>.xml
or
UNIX
cd $ESP_HOME/cluster/nodes/<nodename>
$ESP_HOME/bin/esp_server --cluster-node <nodename>.xml
- Deploy the ESP project on the cluster:
Windows
%ESP_HOME%\bin\esp_cluster_admin" --uri=esp://localhost:19011
--username=sybase --password=sybase --add_project --workspacename=
<workspacename> --project-name=<projectname> --ccx=<modelname>.ccx
or
UNIX
$ESP_HOME/bin/esp_cluster_admin" --uri=esp://localhost:19011
--username=sybase --password=sybase --add_project --workspacename=
<workspacename> --project-name=<projectname> --ccx=<modelname>.ccx
- Start the deployed project on the cluster:
Windows
%ESP_HOME%\bin\esp_cluster_admin" --uri=esp://localhost:19011
--username=sybase --password=sybase --start_project --
workspace-name=<workspacename> --project-name=<projectname>
or
UNIX
$ESP_HOME/bin/esp_cluster_admin" --uri=esp://localhost:19011
--username=sybase --password=sybase --start_project --
workspace-name=<workspacename> --project-name=<projectname>
- Modify the start.bat or start.sh script
file in the %ESP_HOME%\adapters\framework\bin directory to set
the suspend debug parameter to y.
For example,
set DEBUG_PARA=-Xdebug
-Xrunjdwp:transport=dt_socket,address=8998,server=y,suspend=y
- Start the adapter in debug mode:
Windows
%ESP_HOME%\adapters\framework\bin\start.bat
<ADAPTER_EXAMPLE_CONFIG_FILE> –debug
or
$ESP_HOME/adapters/framework/bin/start.sh
<ADAPTER_EXAMPLE_CONFIG_FILE> –debug
where
<ADAPTER_EXAMPLE_CONFIG_FILE> specifies the full path to
the configuration file of the adapter you are debugging.
- Launch Eclipse.
- Select .
- On the left-hand side of the Debug Configurations window, select Remote
Java Application, then right-click and select
New to create a connection to the adapter you wish to
debug.
- On the right-hand side of the Debug Configuration window, select the
Connect tab:
- Specify the name of your adapter in the Name
field.
- Use the Browse... button to select the
ESP project to which your adapter is
connected.
- Select Standard (Socket Attach) from the drop down
menu for Connection Type.
- Specify localhost for the Host connection
property.
- Specify 8998 for the Port connection property.
- Click Apply.
- Select to create a breakpoint at a specific line.
Set all breakpoints before advancing to the next step.
- Click Debug.