Dirisala.Net

Servlet Debugger When I started working on Java Servlets and Java Server Pages (JSPs) in 2000, we used Apache and JServ. During that time, the concept of Servlet Context didn't exist and any changes to the Java code required bouncing the server. Because of this, initially each developer had his own Apache/JServ running on the desktop. However, the application used JDBC connection pooling and so the number of connections to the database was maxing out. As a result, the development model changed to shared development environments. But this resulted in each developer trying to bounce the server to test his code when the other was in the middle of a flow. So, we settled to bouncing the servers every 20 minutes automatically. This meant that when a developer made changes to the Java code he has to wait till the next 20th, 40th or 0th minute of the hour had passed. Ofcourse, JSP changes were instantanous as the JSP class loader had the ability to reload the classes.

So, as you can see, if a developer didn't do the fix properly, he had to wait for another 20 minutes. During one of those frustrating moments, I thought about providing a user interface that could examine the session data without having to put in an extra println statement to examine the value. The result of this excercise is the Servlet Debugger, a single JSP page that lists all the session variables and using Java Reflection, provides a way to navigate the member variables all the way till primitive data types are reached. These days, there are good IDEs such as Eclipse, JDeveloper and NetBeans that integrate a webserver into the IDE so that it's possible to not only examine the variables of a running application but also set breakpoints and step through the code. So, while Servlet Debugger is not such a full fledged debugger, it can still be used against a test/production server (keep security in mind) that runs as a standalone server and outside any of these IDEs. Servlet Debugger is available for download. It has been tested with JServ in the past and with Tomcat recently. Below are the screenshots of Servlet Debugger in action. The first screen shows how the UI looks when there are no session variables and the second one shows how it is possible to navigate down the member variables and go back using the breadcrumbs.

© 2007 Dirisala.Net