An important feature of JDeveloper is its ability to debug EJBs running in either the embedded server or a remote application server. We'll take a brief look at local debugging here. For information about remote debugging, consult Oracle's JDeveloper documentation. To debug a program, we first need to set one or more breakpoints in our program. For example, open HelloWorldClient.java by double-clicking on the filename in the System Navigator. Locate the following line: helloWorld = helloWorldHome.create( ); Clicking on the number to the left of this line will set a breakpoint, indicated by a red dot that replaces the line number. Also set a breakpoint in our EJB, HelloWorldBean.java, at this line: return "Hello, world"; We'll need to restart the HelloWorld EJB with debugging options enabled. To do this, right-click on the HelloWorld bean and select Debug HelloWorld. This will start (or restart) the EJB in debug mode. Notice that we won't enter the EJB code until a client application invokes it. So next, right-click on HelloWorldClient.java and select Debug HelloWorldClient.java. This will start the application and stop at the first breakpoint. Notice that, at this point, the debugging icons are active in the toolbar below the menu. Positioning the mouse pointer over each for a moment will cause a tool tip to appear, identifying its function and its associated shortcut key. These are:
Another important tool is the SmartData view, available under the Tools menu item, which displays a tree view of objects and their attributes. You may wish to spend some time becoming familiar with this and other debug tools. |