tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From laredotornado <laredotorn...@gmail.com>
Subject Re: Why does errorPage work but WEB-INF/web.xml error-page does not?
Date Thu, 27 May 2010 14:54:28 GMT

Perhaps I'm in the denial phase of my grief here, but the only way to
redirect to a 500 page when an error occurs in JSP processing is to increase
the page buffer size?  What if the response is already committed?

- Dave



Kris Schneider-2 wrote:
> 
> Dave - looks like I just posted something for you to try in your
> JavaRanch forum thread...
> 
> Basically, it looks like having a committed response (you've said that
> your original JSP was partially rendered) can interfere with the error
> page mechanism. For testing purposes, try increasing the page buffer
> to see what happens. You may want to consider changing your approach
> to incorporate filters/servlets for some of your processing...
> 
> On Wed, May 26, 2010 at 1:26 PM, laredotornado <laredotornado@gmail.com>
> wrote:
>>
>> I tried your suggestion, and sadly it didn't work.
>>
>> What is the difference between what the errorPage directive does and what
>> the web.xml error-page clause does?  - Dave
>>
>>
>>
>> dcherk wrote:
>>>
>>> Dave:
>>>
>>> I believe you need a fully-qualified class name for the exception, eg:
>>> <error-page>
>>>    <exception-type>java.lang.Exception</exception-type>
>>>    <location>/error-pages/500.jsp</location>
>>> </error-page>
>>>
>>> Good luck,
>>> --
>>> Dave Cherkassky
>>>    VP of Software Development
>>>    DJiNN Software Inc.
>>>
>>>
>>>
>>> On 26/05/2010 10:34 AM, laredotornado wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm running Tomcat 6.0.26 on Mac 10.6.3.  I have this in my
>>>> WEB-INF/web.xml
>>>> file ...
>>>>
>>>>          <error-page>
>>>>                  <exception-type>Exception</exception-type>
>>>>                  <location>/error-pages/500.jsp</location>
>>>>          </error-page>
>>>>
>>>> but when I create a JSP page with
>>>>
>>>> <%= Integer.parseInt("aaa") %>, halfway down the page, I don't get
>>>> redirected to my error page.  I just get an incomplete rendered page.
>>>> But
>>>> when I add this directive to the top ..
>>>>
>>>> <%@ page errorPage="/error-pages/500.jsp" %>
>>>>
>>>> then I can see the error page rendered after the normal content is
>>>> rendered.
>>>> I have included the localhost stack trace in hopes that someone can
>>>> tell
>>>> me
>>>> where Tomcat is supposed to be catching the exception, acting
>>>> appropriately,
>>>> and why it is not.
>>>>
>>>> Thanks, - Dave
>>>>
>>>>
>>>>
>>>> =========Stack trace =======================
>>>> May 26, 2010 9:28:04 AM org.apache.catalina.core.StandardWrapperValve
>>>> invoke
>>>> SEVERE: Servlet.service() for servlet MusicVenueServlet threw exception
>>>> java.lang.NumberFormatException: For input string: "aaa"
>>>>      at
>>>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>>>>      at java.lang.Integer.parseInt(Integer.java:449)
>>>>      at java.lang.Integer.parseInt(Integer.java:499)
>>>>      at
>>>> org.apache.jsp.WEB_002dINF.views.play.music.venues.index_jsp._jspService(index_jsp.java:750)
>>>>      at
>>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>      at
>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
>>>>      at
>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>>>>      at
>>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>      at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>>>>      at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>      at
>>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
>>>>      at
>>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
>>>>      at
>>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
>>>>      at
>>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
>>>>      at
>>>> com.myco.servlet.generic.GenericHttpServlet.callView(GenericHttpServlet.java:570)
>>>>      at
>>>> com.myco.servlet.music.MusicVenueServlet.index(MusicVenueServlet.java:175)
>>>>      at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
>>>>      at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>>      at
>>>> com.myco.servlet.generic.GenericHttpServlet.doGet(GenericHttpServlet.java:549)
>>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>>>      at
>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>>>>      at
>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>      at
>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>>      at
>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>>>      at
>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>>>      at
>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>      at
>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>>      at
>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>>>      at
>>>> org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
>>>>      at
>>>> org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
>>>>      at
>>>> org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
>>>>      at
>>>> org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
>>>>      at
>>>> org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
>>>>      at
>>>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
>>>>      at java.lang.Thread.run(Thread.java:637)
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Why-does-errorPage-work-but-WEB-INF-web.xml-error-page-does-not--tp28681659p28683804.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> -- 
> Kris Schneider
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Why-does-errorPage-work-but-WEB-INF-web.xml-error-page-does-not--tp28681659p28693908.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Mime
View raw message