+

Search Tips   |   Advanced Search

Debug applications

To debug the application, use a development environment like the IBM Rational Application Developer for WebSphere to create a Java project. We must then import the program to debug into the project.

After following the steps in this topic we can import the WAS examples into a Java project. Two debugging styles are available:

Breakpoints actually work with both styles of debugging. Step-by-step mode just lets you see which web objects are being called without having to set up breakpoints ahead of time.

You do not need to import an entire program into the project. However, if we do not import all of the program into the project, some of the source might not compile. We can still debug the project. Most features of the debugger work, including breakpoints, stepping, and viewing and modifying variables. We must import any source to set breakpoints in.

The inspect and display features in the source view do not work if the source has build errors. These features let you select an expression in the source view and evaluate it.

  1. Create a Java Project...

      New Project | Java | Java Project Next

  2. Specify a name for the project, for example, WASExamples.

  3. Click Finish to create the project.

  4. Import the JSP files and Java source for the examples into your project.

      Project name | File | Import | File System | Next | profile_root/installedApps/node/DefaultApplication.ear/DefaultWebApplication.war | Finish

  5. Add any JAR files needed to build to the Java Build Path.

      (right-click) Properties | Java Build Path node | Libraries tab Add External JARs

      ...and add the following JAR files...

      • profile_root/installedApps/node/DefaultApplication.ear/Increment.jar.
      • app_server_root/dev/JavaEE/j2ee.jar
      • app_server_root/plugins/com.ibm.ws.runtime.jar
      • app_server_root/plugins/com.ibm.ws.webcontainer.jar

      For the Increment.jar file, select it, and use the Attach Source function.

      Click OK when we have added all of the JARs.

    • We can set some breakpoints in the source at this time if you like, however, it is not necessary as step-by-step mode will prompt you whenever the server calls a method on a web object.

  6. Start WAS in debug mode, and make note of the JVM debug port. The default value of the JVM debug port is 7777.

  7. After the server is started, switch to the debug perspective...

      Window | Open Perspective | Debug

    We can also enable the debug launch in the Java Perspective...

      Window | Customize Perspective | Other| Debug | Launch

  8. Select the workbench toolbar Debug pushbutton, and then select WebSphere Application Server Debug from the list of launch configurations.

    Click the New pushbutton to create a new configuration.

  9. Give the configuration a name, and select the project to debug.

    Change the port number if you did not start the server on the default port (7777).

  10. Click Debug to start debugging.

  11. Load one of the examples in the browser. For example:

      http://your.server.name:9080/hitcount


What to do next

To learn more about debugging, launch RAD for WebSphere, select...

To learn about known limitations and problems associated with the IBM RAD for WebSphere, see release notes. For current information available from IBM Support on known problems and their resolution, see the IBM Support page.

IBM Support has documents that can save you time gathering information needed to resolve this problem. Before opening a PMR, see the Must gather documents page for information to gather to send to IBM Support.


Subtopics