Debugging a Java Service

The Eclipse Java debugger connects to the server where your service runs, allowing you to step through the source code, investigate variables and the stack, just as if you were debugging a local Java class.

Prerequisites 

Before beginning the debug process, verify that your Java service compiled successfully, and there are no errors.

  1. Create a test client to invoke the service methods using the Web Service Client wizard:
    1. Select File > New > Other from the main menu bar.
    2. Select Sybase > Services > Service Test from the Service Selection page and click Next.
    3. Select Create Web Service Client Wizard from the Wizard Selection page and click Next.
    4. Follow the instructions in the wizard to create the Web service client.
  2. Do one of the following:
    Option Action
    If the service is not deployed to the server that you want to debug against Create a service package and deploy it
    If the service is deployed Ensure the deployed implementation matches the source that you are debugging against. Redeploy if you modified the source.
  3. To configure the EAServer runtime that hosts your service to support remote debugging using the Java Platform Debug Architecture (JPDA) interface, select one of the following:
    • If deploying to Service Container, follow the instructions in Running the Service Container Server in Java Debug Mode.
    • If deploying to the EAServer Web services toolkit:
    1. Start EAServer Manager and connect to the server.
    2. To display the server properties, on the Java Debug tab, select Use JPDA and enter the number of a free port for the JPDA connection.
    3. Restart the server in debug mode.

      For more details, see the EAServer documentation located at the main level of the Sybase WorkSpace online bookshelf. If this server documentation is not installed, the documentation is available on the Sybase Product Manuals Web site at http://sybooks.sybase.com.

  4. In Eclipse, create a Remote Java Application configuration to connect to the runtime server that hosts your service:
    1. Switch to the Java or Debug perspective.
    2. Select Run > Debug... from the main menu bar.
    3. Select Remote Java Application and click New.
    4. Configure the following settings on the Connect tab:
      • Name – specify a name for the configuration.
      • Project – select the project that contains the source for your service.
      • Connection type – select Standard (Socket Attach).
      • Host – enter the host or IP address for the EAServer connection.
      • Port – enter the EAServer JPDA port.

      Leave other settings at their default values.

    5. Click Debug to close the Debug dialog and start the debugging session.

      The debugging session remains inactive until you run a test that executes a breakpoint in your service implementation.

  5. To set breakpoints using the Java source editor or the Source page in the Java Service editor, directly to the left of the line where you want to add the breakpoint, right-click the marker bar (vertical ruler) and select Toggle Breakpoint.

    A new breakpoint marker appears on the marker bar, directly to the left of the line where you added the breakpoint. For more details on configuring breakpoints, see the Java Development User Guide.

  6. To remove a breakpoint, right-click on the breakpoint marker and select Toggle Breakpoint.
  7. Run the test client.

    When a breakpoint in the Java Service source is reached, Eclipse activates a remote debugging session, switching the to the Debug perspective where you can step through the code, investigate the stack, inspect variables, and so forth. For details on using the debugger, see the Java Development User Guide.

Related concepts
Java Service Debugging

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.