JBuilder 4 / 5: Debugging JSP's in a different Web Server than the one that is included with JBuilder

By: Josh Fletcher

Abstract: Steps that will possibly allow users to debug JSP's running on an arbitrary Web server.


Question:

How can I debug JSP's running under <insert Web server name here> with JBuilder?

 
Answer:

Note: The steps suggested here are not supported by Borland Developer Support. Please feel free to use and modify them to suit your needs. Also, some of these steps require JBuilder 4/5 Enterprise (for remote debugging).

The only JSP debugging possible in JBuilder 4/5 Enterprise out of the box is through the use of the bundled Web server (Tomcat 3.1 or 3.2). This is due to the fact that all web servers handle the mapping from JSP to servlet differently. As such JBuilder has a "plug-in" that allows it to integrate with Tomcat 3.1 or 3.2 and give you the illusion that you are setting breakpoints in your JSP file when you are really just debugging a servlet that was generated from the JSP. It is, of course, possible to create your own plug-in for your own Web server via JBuilder's OpenTools API. There is a demonstration of doing this for Tomcat 3.2, including source code, on CodeCentral, Borland's code repository.

As an alternative, it is possible to debug the servlet that was generated from your JSP using JBuilder 4/5. There are at least two ways to do this.

The first involves JBuilder 4/5 Enterprise's Remote Debugging feature:

  1. Compile the JSP file on your Web Server and tell the server to keep the generated source file. Also be sure that the server is compiling with debug info turned on.
  2. Add the generated source file to your JBuilder Project.
  3. Set breakpoints in the generated source file.
  4. Add an entry in your Project Properties under the Source tab that points to the package root of the generated source file.
  5. Remote debug your Web Server.
  6. Call your JSP.

Essentially what you are doing is debugging the *servlet* that is created from the JSP and not the JSP file itself.

The second method can work in all versions of JBuilder 4/5 and involves the same steps as above, with the exception of the remote debugging. Instead of remote debugging the Web server you can try setting up a JBuilder project to run/debug the Web server in the IDE. This is by no means an uncomplicated process. The steps to do this will vary widely as well but the main piece you need is for the Web server to be a Java application and to be able to launch it with a Java command line. It will then be a matter of setting up all of the command line parameters and path information in the Project Properties. You will need to check your Web server documentation to figure out how the environment needs to be configured.

As these steps are not supported by Borland, if you have questions you can try posting to the JBuilder newsgroups:

http://www.borland.com/newsgroups/#jbuilder

 

Server Response from: SC1