Question

Is it possible to start Tomcat in "Debug Mode" (JPDA enabled for remote debugging session via Eclipse) and have it serve requests from hundreds of users in normal/production mode, but only "act" in debug mode (jumping to breakpoints, allowing me to step through code line by line, inspect variable values, etc.) for a single user?

If so, how? And if not, why?

Was it helpful?

Solution

Sorry, no. JPDA is an all or nothing option. Either the entire application is available for debugging or none of it is.

What you can do is isolate a single request and then step through the code from there. One way would be to write a filter that only executes a given line of code for a specific user and then place a break point on that line. You can then step through the code for that user. What you won't be able to do is add further break points elsewhere in the application because they could be hit by any user.

A possible extension would be to set a request attribute in your filter for this single user and then add tests for that attribute in the application code. You could then place breakpoints in code that was only executed if that request attribute was true. It is a fairly invasive solution though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top