You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Brian Long <bl...@annadaletech.com> on 2012/01/31 11:50:49 UTC

Exception handling in Tomcat 6.0.33

Hi all,

I'm sure I'm not the first person to experience this issue but can't
seem to find any answers in the mail archive or on the web. I have an
ExceptionReport page implementing ExceptionReporter so any nasty
surprises like NPE's result in a nice and friendly "We experiencing
technical difficulties" page being presented to the user, this works
fine in jetty but when I deploy my war file to tomcat 6, the
exceptions are not caught by the ExceptionReporter and the stacktrace
is shown to the user?

If anyone know what setting in tomcat needs to change so I can get
this to work as it does in jetty I appreciate it.

Regards, Brian.


Re: Exception handling in Tomcat 6.0.33

Posted by Kalle Korhonen <ka...@gmail.com>.
Good thing, that's one way to set things up and I've used it myself
but it only goes half way. The even better idea (if I say so myself)
is to use Tynamo's (and in the future core Tapestry)
tapestry-exceptionpage module for mapping exceptions directly to error
pages (see http://tynamo.org/tapestry-exceptionpage+guide).

Kalle


On Tue, Jan 31, 2012 at 8:41 AM, Brian Long <bl...@annadaletech.com> wrote:
> Hi Kalle,
>
> yes I managed finally track down the answer after searching through
> pages of search results, unfortunately my original search query
> included the terms "tomcat", "tapestry" and "error" which produces
> reams of result (most of them irrelevant)!
>
> Like you mentioned in your reply I needed to add an error dispatcher
> (like example here: http://tapestry.apache.org/error-page-recipe.html)
>
>    <filter-mapping>
>        <filter-name>app</filter-name>
>        <url-pattern>/*</url-pattern>
>        <dispatcher>FORWARD</dispatcher>
>        <dispatcher>REQUEST</dispatcher>
>        <dispatcher>ERROR</dispatcher>
>    </filter-mapping>
>
> I then mapped error codes to tapestry URLs
>
>    <error-page>
>        <error-code>500</error-code>
>        <location>/ExceptionReport</location>
>    </error-page>
>    <error-page>
>        <error-code>404</error-code>
>        <location>/ExceptionReport</location>
>    </error-page>
>
> Tomcat then started to redirect these error types to my Exception
> Report page like Jetty already does. Hopefully this answer will be
> found by the next person looking into this issue.
>
> Thanks for the link explaining why the tapestry exception report
> filter works in Jetty but not in Tomcat . . .
>
> Regards, Brian.
>
> On 31 January 2012 16:18, Kalle Korhonen <ka...@gmail.com> wrote:
>> Are you setting an error code to your response? You haven't configured
>> the filter to handle error dispatches:
>>        <filter-mapping>
>>                <filter-name>app</filter-name>
>>                <url-pattern>/*</url-pattern>
>>                <dispatcher>REQUEST</dispatcher>
>>                <dispatcher>ERROR</dispatcher>
>>        </filter-mapping>
>>
>> Error handling in Jetty and Tomcat differ, see
>> http://www.cacoethes.co.uk/blog/software/a-tomcat-gotcha for more
>> info.
>>
>> Kalle
>>
>>
>> On Tue, Jan 31, 2012 at 2:50 AM, Brian Long <bl...@annadaletech.com> wrote:
>>> Hi all,
>>>
>>> I'm sure I'm not the first person to experience this issue but can't
>>> seem to find any answers in the mail archive or on the web. I have an
>>> ExceptionReport page implementing ExceptionReporter so any nasty
>>> surprises like NPE's result in a nice and friendly "We experiencing
>>> technical difficulties" page being presented to the user, this works
>>> fine in jetty but when I deploy my war file to tomcat 6, the
>>> exceptions are not caught by the ExceptionReporter and the stacktrace
>>> is shown to the user?
>>>
>>> If anyone know what setting in tomcat needs to change so I can get
>>> this to work as it does in jetty I appreciate it.
>>>
>>> Regards, Brian.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Exception handling in Tomcat 6.0.33

Posted by Brian Long <bl...@annadaletech.com>.
Hi Kalle,

yes I managed finally track down the answer after searching through
pages of search results, unfortunately my original search query
included the terms "tomcat", "tapestry" and "error" which produces
reams of result (most of them irrelevant)!

Like you mentioned in your reply I needed to add an error dispatcher
(like example here: http://tapestry.apache.org/error-page-recipe.html)

    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

I then mapped error codes to tapestry URLs

    <error-page>
        <error-code>500</error-code>
        <location>/ExceptionReport</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/ExceptionReport</location>
    </error-page>

Tomcat then started to redirect these error types to my Exception
Report page like Jetty already does. Hopefully this answer will be
found by the next person looking into this issue.

Thanks for the link explaining why the tapestry exception report
filter works in Jetty but not in Tomcat . . .

Regards, Brian.

On 31 January 2012 16:18, Kalle Korhonen <ka...@gmail.com> wrote:
> Are you setting an error code to your response? You haven't configured
> the filter to handle error dispatches:
>        <filter-mapping>
>                <filter-name>app</filter-name>
>                <url-pattern>/*</url-pattern>
>                <dispatcher>REQUEST</dispatcher>
>                <dispatcher>ERROR</dispatcher>
>        </filter-mapping>
>
> Error handling in Jetty and Tomcat differ, see
> http://www.cacoethes.co.uk/blog/software/a-tomcat-gotcha for more
> info.
>
> Kalle
>
>
> On Tue, Jan 31, 2012 at 2:50 AM, Brian Long <bl...@annadaletech.com> wrote:
>> Hi all,
>>
>> I'm sure I'm not the first person to experience this issue but can't
>> seem to find any answers in the mail archive or on the web. I have an
>> ExceptionReport page implementing ExceptionReporter so any nasty
>> surprises like NPE's result in a nice and friendly "We experiencing
>> technical difficulties" page being presented to the user, this works
>> fine in jetty but when I deploy my war file to tomcat 6, the
>> exceptions are not caught by the ExceptionReporter and the stacktrace
>> is shown to the user?
>>
>> If anyone know what setting in tomcat needs to change so I can get
>> this to work as it does in jetty I appreciate it.
>>
>> Regards, Brian.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: Exception handling in Tomcat 6.0.33

Posted by Kalle Korhonen <ka...@gmail.com>.
Are you setting an error code to your response? You haven't configured
the filter to handle error dispatches:
	<filter-mapping>
		<filter-name>app</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>

Error handling in Jetty and Tomcat differ, see
http://www.cacoethes.co.uk/blog/software/a-tomcat-gotcha for more
info.

Kalle


On Tue, Jan 31, 2012 at 2:50 AM, Brian Long <bl...@annadaletech.com> wrote:
> Hi all,
>
> I'm sure I'm not the first person to experience this issue but can't
> seem to find any answers in the mail archive or on the web. I have an
> ExceptionReport page implementing ExceptionReporter so any nasty
> surprises like NPE's result in a nice and friendly "We experiencing
> technical difficulties" page being presented to the user, this works
> fine in jetty but when I deploy my war file to tomcat 6, the
> exceptions are not caught by the ExceptionReporter and the stacktrace
> is shown to the user?
>
> If anyone know what setting in tomcat needs to change so I can get
> this to work as it does in jetty I appreciate it.
>
> Regards, Brian.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org

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