Hard To Debug

Whenever I start debugging the struts based web application I am working on the server freezes. I am using JBoss/Tomcat with Struts 1.1 and Eclipse 3.1. Since I can’t fire up the debugger, mark breakpoints, and set expressions I fell back to the tried and tested ‘printf method of debugging’. I call it ‘printf’ because I learned to debug this way back in my C programming days in college. Since I couldn’t fire up the debugger and examine the strack trace I throw my own debugging exceptions and print out the last few lines method calls in the stack.

    try {
        // TODO: Remove/debug
        throw new Exception("DEBUG EXCEPTION");
    }catch (Exception ex) {
        Object[] stack = ex.getStackTrace();
        for(int i=0; i < 4; i++) {
            System.out.println(stack[i]);
        }
    }

I should probably look more deeply into why the server freezes when I start up the debugger. On the other hand, I have managed to come up with a work around to get the job done.