Show TOC

Debugging a Custom AdapterLocate this document in the navigation structure

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.
  • Ensure that the ESP cluster database and node on which your project runs are started. See Starting a Cluster Database in the SAP Event Stream Processor: Configuration and Administration Guide for detailed instructions.

Context

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.

Procedure

  1. Choose an example adapter from %STREAMING_HOME%\adapters\framework\examples or another adapter of your choice.
  2. Compile the transporter and formatter module Java files to .class files (debug version) and compress them to .jar files using the jar.exe tool.
  3. Copy these debug files to the %STREAMING_HOME%\adapters\framework\libj directory.
  4. Back up the modulesdefine.xml file in the $STREAMING_HOME/adapters/framework/config directory.
  5. (Perform only if debugging an example adapter) Prepare the adapter configuration file:
    1. Copy the $STREAMING_HOME/adapters/framework/examples/modulesdefine.xml file to the $STREAMING_HOME/adapters/framework/config.
    2. 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.
  6. Deploy the ESP project on the cluster:
    Windows
    %STREAMING_HOME%\bin\streamingclusteradmin" --uri=esp[s]://localhost:19011
    --username=sybase --password=sybase --add_project --workspacename=
    <workspacename> --project-name=<projectname> --ccx=<modelname>.ccx
    or
    UNIX
    $STREAMING_HOME/bin/streamingclusteradmin" --uri=esp[s]://localhost:19011
    --username=sybase --password=sybase --add_project --workspacename=
    <workspacename> --project-name=<projectname> --ccx=<modelname>.ccx
  7. Start the deployed project on the cluster:
    Windows
    %STREAMING_HOME%\bin\streamingclusteradmin" --uri=esp[s]://localhost:19011
    --username=sybase --password=sybase --start_project --
    workspace-name=<workspacename> --project-name=<projectname>
    or
    UNIX
    $STREAMING_HOME/bin/streamingclusteradmin" --uri=esp[s]://localhost:19011
    --username=sybase --password=sybase --start_project --
    workspace-name=<workspacename> --project-name=<projectname>
  8. Modify the start.bat or start.sh script file in the %STREAMING_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
  9. Start the adapter in debug mode:
    Windows
    %STREAMING_HOME%\adapters\framework\bin\start.bat
    <ADAPTER_EXAMPLE_CONFIG_FILE> –debug
    or
    $STREAMING_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.
  10. Launch Eclipse.
  11. Select Start of the navigation path Run Next navigation step Debug Configurations End of the navigation path.
  12. 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.
  13. On the right-hand side of the Debug Configuration window, select the Connect tab:
    1. Specify the name of your adapter in the Name field.
    2. Use the Browse... button to select the ESP project to which your adapter is connected.
    3. Select Standard (Socket Attach) from the drop down menu for Connection Type.
    4. Specify localhost for the Host connection property.
    5. Specify 8998 for the Port connection property.
    6. Click Apply.
  14. Select Start of the navigation path Run Next navigation step Toggle Breakpoint End of the navigation path to create a breakpoint at a specific line.
    Set all breakpoints before advancing to the next step.
  15. Click Debug.