I was having a problem with some java one day, I’d made a change to some code and I kept getting a StackOverflowError. Unfortunately the stack trace didn’t help and some time inspecting the code didn’t offer any quick solutions. So I turned obviously to Google. The answer was simple, although it took some work to find it.
If you get a StackOverflowError in java it can sometimes be difficult to identify where the problem is occurring. This is because in some versions of the JVM the relevant stack trace isn’t automatically provided. This is the case in 1.4.2 when using the JIT compiler. (which I was)
One work around that worked for me was to add the -Xint option to the java call. This forces the JVM to use interpret the code rather than attempt to compile it. The interpreter will provide a stack trace and the problem can be easily found and fixed.
The bug report that gave the answer is at Sun: