tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Терехов Кирилл Александрович <te...@hitmp3.ru>
Subject Catching runtime exception
Date Sat, 04 Feb 2006 15:15:37 GMT
I don't understand, how to catch exceptions in 
javax.servlet.http.HttpServlet.doGet.
This code works fine:

    public void doGet |(HttpServletRequest req, HttpServletResponse resp)
  {
    ...
    ...
    bla-bla-bla
    throw new ServletException ("my exception");
  }

I redirect exceptions to my error servlet page by web.xml:

    <error-page>
       <exception-type>java.lang.Exception</exception-type>
       <location>/error</location>
    </error-page>

but this code is not working in doGet (...). I don't get control to my 
error servlet:

    try
    {
        java.nio.charset.Charset charset = 
java.nio.charset.Charset.forName ("unexisting charset");
    }
    catch (Exception e)
    {
        throw new ServletException ("Perkele: Charset error", e);
    }


I have exception list in tomcat container log file:

    java.nio.charset.UnsupportedCharsetException: unexisting exception
    ....
    Exception Processing ErrorPage[exceptionType=java.lang.Exception, 
location=/error]
    java.lang.IllegalStateException

Question is, how can i control all exceptions in my servlet code?
Thanks!
|

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message