Chapter 12. Debugging

Prior to the debugging, we need to set some breakpoints inside the code.

Open the FiboBean.java file. Double click in left column to create a breakpoint.

In the example, the breakpoint is set in front of the test.

Open the ComputeServlet.java file. Double click in left column to create a breakpoint.

In the example, the breakpoint is set in front of the EJB creation.

Open a web browser and type http://localhost:8080/fibo/. The host/port can change if the web server listens on another host/port. You should see a simple form like the one above. Enter a positive value in the field and press Compute.

Switch to your Eclipse workbench. You should see that execution has been suspended on the first breakpoint (in the servlet). You can go step by step in the code or continue with execution.

Another suspension occurs when hitting the second breakpoint (in the EJB). You can go step by step in the code or continue with execution.

After resuming execution, the response should be in the browser. It should look something like this: