Re: tomcat error..



Lew wrote:
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.


well, the weird thing is, sometimes it shows in what line in JSP servlet the error is, I find my way to the servlet and find line causing error, which is quite useful, but sometimes it doesn't tell you anything, like example I posted above.. (tomcat "doesn't execute JSP's" what....???? tomcat is not the servlet engine???)

one of the main problems I have in general with JSP's is that sometimes they stop generating interface code "in midstream" and I have no idea why.. someone here suggested defining an error pg and stuff, which I did, but it's also not too useful, as sometimes it doesn't show error at all, it just says "Exception: " then nothing...

I don't use any IDE at all, develop in HomeSite (HTML editor) and that's it.. (if doing servlets or stand-alone classes I compile "manually" in DOS shell.. I guess it might be a good idea for me to start using Eclipse or something...;)

what IS log4j... at work we use weblogic, not tomcat.. I always see "log4j" (or something like that) in weblogic console when booting up weblogic..

ok, thank you very much..




.



Relevant Pages

  • log4j file appender relative path + sysdeo plugin in Eclipse for launching Tomcat
    ... If I launch Tomcat using the tomcat monitor program (i.e. outside Eclipse), log4j writes to a log file with a path relative to the servlet root, which is the desired behaviour. ...
    (comp.lang.java.programmer)
  • Re: Tomcat + java.io.FileNotFoundException
    ... Application Server executes servlet and JSP in their own context (both ... > experience configuring tomcat. ... > 1- the File class uses paths relative to the working directory. ... However, classA is ...
    (comp.lang.java.programmer)
  • Re: A2LL ist tot...
    ... | mit Tomcat als Servlet Container. ... | # Bugs - You think you have a bug or there is a difference in behavior with another servlet container. ... | # Database - Getting tomcat to talk to a database. ...
    (de.talk.tagesgeschehen)
  • Re: tomcat error..
    ... Remember that Tomcat doesn't execute JSPs, so it has no way of knowing where in "YOUR FILE" the error is. ... 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, ... 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. ...
    (comp.lang.java.help)
  • Re: servlet problems with session attributes
    ... I use session attributes to to preserve data across the ... >> session and to comunicate across servlet objects. ... >> restarting the Tomcat container! ... > one or two jsps and one or two servlets. ...
    (comp.lang.java.programmer)