Re: tomcat error..
maya wrote:
why does tomcat sometimes give so little info on what is causing an
error... how am I supposed to know what causes this error??
By debugging the code first, then putting it in production.
org.apache.jasper.JasperException: Unable to compile class for JSP:
[ info missing here it seems...........]
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
the stacktrace is useless if it doesn't show you line in YOUR FILE where
error is occurring.... :( this is very annoying.. (tomcat 5.5..)
Tomcat is not a development tool. It does run in a debug mode, that is, the
JVM it rests on can. So smart IDEs can run your code within a Tomcat instance
and breakpoint on JSP lines for you.
Remember that Tomcat doesn't execute JSPs, so it has no way of knowing where
in "YOUR FILE" the error is. It only knows where in ITS FILEs there's an
error, and dutifully reports that in its stack trace. Now, what, it should
start reading minds? What if the class is compiled with debug options turned
off, as is usual in production systems? (Or rather, would that it were usual.)
Within the loving arms of your IDE you can make these connections. The IDE
itself tracks how the code transmutes from source to translated source to
object to run-time.
To diagnose problems that only show up in production (or the simulated
production environment of going directly to Tomcat without the IDE's
intervention), develop a good logging strategy. Use java.util.logging or
log4j, and think about the hapless operations folk when you design logging.
The log statements can change detail levels in the field, useful when
narrowing down the exact location of a fubar.
Of course, log statements cannot directly tell where in YOUR FILE an error
occurred, but they can focus your attention closely enough that the brain can
leap the gap.
--
Lew