This section describes the basic procedure of debugging a servlet. This procedure was tested on WinNT with Sun JVM 1.3 and on Linux with IBM JVM 1.3. At the conclusion of this section there is also a note on debugging Java Server Pages (JSP).
Make sure JDK 1.3 and JSDK 2.1 are installed on your computer. Default directories are:
|
Platform |
Default directories |
|
WinNT |
C:\jdk1.3 and C:\jsdk2.1 |
|
Linux |
/usr/local/IBMJava2-13 and /opt/jsdk2.1 |
Check environment variables in the batch file and correct them if necessary:
|
Platform |
Batch files |
|
WinNT |
%TGH%\bin\win32\DebugServlet.bat |
|
Linux |
%TGH%/bin/linux/DebugServlet |
Create new project:
Select New Project on the File menu
Press 'Advanced >>' button.
Press 'Remove' button in the 'Project Paths' tab to delete the default project path
Specify the required path for your project. Press 'Add Path' button and select path:
|
Platform |
Path |
|
WinNT |
C:\jsdk2.1\examples\WEB-INF\servlets |
|
Linux |
/opt/jsdk2.1/examples/WEB-INF/servlets |
Hit OK to quit the dialog, and see 6 servlet classes on the diagram pane of your project:

Start batch file:
|
Platform |
Batch files |
|
WinNT |
%TGH%/bin/win32/DebugServlet.bat |
|
Linux |
%TGH%/bin/linux/DebugServlet |
The command window does not show any messages, until you perform the following step:
Select Run/Debug | Attach to remote process on the Tools menu. In the dialog set the following values:
The following messages appear in the command window:
Start your preferred web browser.
Specify address http://localhost:8080.
See standard JSDK 2.1 welcome page.
Tip: If you work with the Win platform, and can't see Welcome page, use lowercase letters only for the JSDK path. If this doesn't help, move the DebugServlet.bat file to JSDK folder and run it from there.
Click on "Servlet examples" and see the list of 6 servlet examples:
Switch to TogetherIDE
Select class 'HelloWorldExample'.
Set a breakpoint at any line within 'doGet' method, e.g. line 25.
Switch to the web browser.
Click on 'Execute' for Hello World.
Servlet starts and stops at your breakpoint
In general JSP debugging is possible. However, it's not a transparent process, as one must take into account the specific JSP functionality of a given server. Two main points should be taken into account when considering the possibility of debugging a JSP using Together:
The Together integrated debugger is Java debugger. Debug process flow starts and stops in Java code.
The debugger can debug any remote process if host, protocol and address (port) of the process are specified.
From a http request to a JSP, the server produces Java code, compiles it, and runs it. The debugger cannot trace the indivisual JSP page itself, since that is not Java code. But if, as part of remote processing, the server will run a corresponding method in the .class file that it compiled, then in principle attaching the debugger to that running code is possible.
Thus, the question is in what functionality is provided by thecific server. If the server:
- runs methods from generated classes as a part of remote process;
- runs process in debug mode;
- provides info about this process as remote one;
...then you can set this info in the "Attach to remote process" dialog.
More robust JSP support for specific server platforms is planned for upcoming releases.