"Catch all" exception in a servlet

I have a servlet that is deployed on WebLogic 8.1. At one point I am initializing a XSLT processor that is throwing an error.

I don't know what error as the Servlet implementation (AIX machine, JDK 1.4) is catching it and showing me "Page cannot be displayed"

Is there any configuration that tells a web application to catch all the errors?

[360 byte] By [dragosionela] at [2007-11-27 2:53:33]
# 1

Hi,

Are you looking at the server logs to see what the error was?

If you allow the servlet container to catch the exception, it should be logging some type of message to let you know what is going on. This is how the Glassfish appserver works ( http://glassfish.dev.java.net ).

If you don't see a message in the log, you can wrap your servlet code with a try catch block and log the exception, for example:

try {

// YOUR CODE

} catch (Exception e) {

e.printStackTrace();

}

If you are still having problems, you may want to deploy the application on the Glassfish application server, which would show the error in the log automatically.

To further simplify your development, you can use the Netbeans IDE ( http://netbeans.org ) to develop your servlet. It has code completion and syntax highlighting that helps identify errors quickly.

Hope this helps...

Thanks - Mark

markbaslera at 2007-7-12 3:28:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Thanks, the problem was that it was not throwing and Exception that why it was not picked by a try{...} catch(Exception e).It was throwing an java.lang.Error (java.lang.VerifyError) so I was able to pick it up with try{...} catch(Throwable e).
dragosionela at 2007-7-12 3:28:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...