Debugging the Application

You can debug both the JVM COBOL and Java code in the same process.
  1. Set a breakpoint in the JVM COBOL code:
    1. In the Project Explorer, choose TemperatureConverter > src > com.microfocus.converter > TemperatureConverter.cbl.

      The JVM COBOL business logic appears in the main pane.

    2. Double-click the marker bar to the left of the compute statement in the toCelsius method.

    The breakpoint is set.
  2. Set a breakpoint in the Java code:
    1. In the Project Explorer pane, choose TemperatureConverterEJB > ejbModule > com.microfocus.businesslogic > TemperatureConverterBean.java.

      The Java code appears in the main pane.

    2. Double-click the marker bar to the left of the c declaration in the toCelsius method.

    The breakpoint is set.
  3. Right-click TemperatureConverterPrj, then choose Debug As > Debug on Server.

    This opens the Debug On Server dialog box.

  4. Ensure that Red Hat JBoss EAP 7.1 is selected and click Finish.

    You receive a notification that the server is not running in debug mode.

  5. Ensure Switch mode (will restart if necessary) is selected and click OK.
    The server is restarted in debug mode. A browser window is opened in the IDE, showing the following URL:
    http://localhost:8080/TemperatureConverterPrj/
    . You can ignore the HTTP Status code message. EJB does not have a landing page and you need to enter the URL for the application manually.
  6. In the browser window, load to the following URL:
    http://localhost:8080/TemperatureConverterPrj/RestApp1/getCelsius?fahrenheit=212
  7. If you are prompted to switch to the Debug perspective, click Yes.

    The breakpoint is hit and execution breaks in the Java program. At this point, you can step through the program as normal.

  8. Press F8 to resume execution.
    The compute breakpoint is hit and execution breaks in the JVM COBOL program.
    Note: If you get a Source not found message, perform the following steps:
    1. Click Edit Source Lookup Path.

      This opens the Edit Source Lookup Path dialog box.

    2. Click Add.
    3. Click COBOL Project.
    4. Click OK.

      This opens the Selection Needed dialog box.

    5. Check the TemperatureConverter project.
    6. Click OK.
    7. Click OK.
  9. Continue debugging, or press Ctrl+F2 to terminate. You can click COBOL in the right upper corner of the IDE to switch back to the Team Developer perspective.