tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terence M. Bandoian" <tere...@tmbsw.com>
Subject Re: Catching Exception "in Application"
Date Fri, 27 Jan 2012 23:46:16 GMT
  On 1:59 PM, Pid wrote:
> On 27/01/2012 18:53, Jonathan Rosenberg wrote:
>> On Fri, Jan 27, 2012 at 1:45 PM, Pid<pid@pidster.com>  wrote:
>>> On 27/01/2012 18:38, Jonathan Rosenberg wrote:
>>>> That is in the original CAS server web.xml.  I left it untouched.
>>> For the rest of the day, as an experiment I will bottom-post to any
>>> thread containing a reply via top-post.
>>>
>>>
>>>> On Fri, Jan 27, 2012 at 1:35 PM, Pid<pid@pidster.com>  wrote:
>>>>> On 27/01/2012 18:00, Jonathan Rosenberg wrote:
>>>>>> Vital stats:
>>>>>>
>>>>>> Apache Tomcat/7.0.22  1.6.0_20-b20    Sun Microsystems Inc.   Linux
>>>>>>        2.6.34.7-56.40.amzn1.i686
>>>>>>
>>>>>> I have a CAS server deployed on this instance.
>>>>>>
>>>>>> I am trying to catch errors within the server (e.g., DB down) so
I can
>>>>>> display friendly page to user&  log error.
>>>>>>
>>>>>> In the web.xml for the CAS server I have (I added error-page for
>>>>>> java.lang.Exception, ohters were already there)
>>>>>>
>>>>>> <error-page>
>>>>>>                <exception-type>org.springframework.context.ApplicationContextException</exception-type>
>>>>>>                <location>/WEB-INF/view/jsp/brokenContext.jsp</location>
>>>>>>        </error-page>
>>>>>>
>>>>>>        <error-page>
>>>>>>                <exception-type>java.lang.Exception</exception-type>
>>>>>>                <location>/WEB-INF/view/jsp/exception.jsp</location>
>>>>>>        </error-page>
>>>>>>
>>>>>>        <error-page>
>>>>>>          <error-code>500</error-code>
>>>>>>                <location>/WEB-INF/view/jsp/errors.jsp</location>
>>>>>>        </error-page>
>>>>>>
>>>>>>        <error-page>
>>>>>>                <error-code>404</error-code>
>>>>>>                <location>/</location>
>>>>>>        </error-page>
>>>>> Is the above correct?  A 404 returns '/'?
>>>>>
>>>>>
>>>>> p
>>>>>
>>>>>>      <error-page>
>>>>>>          <error-code>403</error-code>
>>>>>>          <location>/403.html</location>
>>>>>>      </error-page>
>>>>>>
>>>>>> Bu when I trigger an error (i.e., stop DB) I am seeing the default
>>>>>> Tomcat error page:
>>>>>>
>>>>>> HTTP Status 500 -
>>>>>> type Exception report
>>>>>> message
>>>>>> description The server encountered an internal error () that prevented
>>>>>> it from fulfilling this request.
>>>>>> exception
>>>>>> org.springframework.webflow.execution.ActionExecutionException:
>>>>>> Exception thrown executing [AnnotatedAction@17b2b99 targetAction
=
>>>>>> [EvaluateAction@16b653d expression =
>>>>>> authenticationViaFormAction.submit(flowRequestContext,
>>>>>> flowScope.credentials, messageContext), resultExpression = [null]],
>>>>>> attributes = map[[empty]]] in state 'realSubmit' of flow 'login'
--
>>>>>> action execution attributes were 'map[[empty]]'
>>>>>> . . .
>>>>>>
>>>>>> I'm a newbie to Tomcat&  am not sure where to start looking.
>>>>>>
>>>>>> --
>>>>>> Jonathan Rosenberg
>>>>>> Founder&  Executive Director
>>>>>> Tabby's Place, a Cat Sanctuary
>>>>>> http://www.tabbysplace.org/
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> [key:62590808]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>> Did you post the whole error page definition block?
>>> What was the original contents and what have you added?
>> Original error-page elements:
>>
>> 	<error-page>
>> 		<exception-type>org.springframework.context.ApplicationContextException</exception-type>
>> 		<location>/WEB-INF/view/jsp/brokenContext.jsp</location>
>> 	</error-page>
>>
>> 	<error-page>
>> 		<exception-type>java.lang.Exception</exception-type>
>> 		<location>/WEB-INF/view/jsp/exception.jsp</location>
>> 	</error-page>
>>
>> 	<error-page>
>>          <error-code>500</error-code>
>> 		<location>/WEB-INF/view/jsp/errors.jsp</location>
>> 	</error-page>
>>
>> 	<error-page>
>> 		<error-code>404</error-code>
>> 		<location>/</location>
>> 	</error-page>
>>
>>      <error-page>
>>          <error-code>403</error-code>
>>          <location>/403.html</location>
>>      </error-page>
>>
>> I added this
>>
>> 	<error-page>
>> 		<exception-type>java.lang.Exception</exception-type>
>> 		<location>/WEB-INF/view/jsp/exception.jsp</location>
>> 	</error-page>
> OK, what error page do you get if you cause the error without this entry?
>
>
> p
>
>> --
>> Jonathan Rosenberg
>> Founder&  Executive Director
>> Tabby's Place, a Cat Sanctuary
>> http://www.tabbysplace.org/

Hi, Jonathan-

 From the Java Servlet Specification:

The location element "contains the location of the resource in the web 
application relative to the root of the web application. The value of 
the location must have a leading ‘/’."

I specify locations as I would access them from the web. For example, 
and depending on how your JSPs are mapped, I would use:

<location>/exception.jsp</location>

as the location sub-element for the java.lang.Exception error page. The 
leading /WEB-INF/view/jsp might be getting in the way.

-Terence Bandoian


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


Mime
View raw message