Hi,


This design have been chosen in order to not penalize an entire page when only one tile fail. With this design, the page is shown correctly, and the faulty tile report an error.
What is missing in this design is a way to customize what should happen in case of error. This is an enhancement request to be added to bugzilla (or vote for it if it already exist).


Cedric

Jörg Maurer wrote:

Wondering why i have no chance to catch any exception i did some
investigation on that topic , so i consulted the java logic of your
insert tag. it is that ~good~ shielded against any exception bubbling,
that my own error handler logic never gets a chance because ALL
EXCEPTIONS HAVE BEEN CAUGTH AND NEVER RETHROWN. next is snip from your
Insert Tag(commented out is your code, underneath that is what i want -
throw new JspException(ex.getMessage())) :


} catch (ServletException ex) {
Throwable realEx = ex;
if (ex.getRootCause() != null) {
realEx = ex.getRootCause();
}
// processException(
// realEx,
// "[ServletException in:" + page +
"] " + realEx.getMessage() + "'");
throw new JspException(ex.getMessage());
} catch (Exception ex) {
// processException(ex, "[Exception in:" +
page + "] " + ex.getMessage());
throw new JspException(ex.getMessage());
} finally {
// restore old context
// done only if currentContext not null
(bug with Silverstream ?; related by Arvindra Sehmi 20010712)
if (currentContext != null)
pageContext.setAttribute(

ComponentConstants.COMPONENT_CONTEXT,
currentContext,

pageContext.REQUEST_SCOPE);
}
return EVAL_PAGE;


Looking at Geary´s template insert tag, he always chose to do "throw new
JspException(ex.getMessage());".

Your logic displays by default a simple stack trace(Exception type and
exception message) of where the tile should be. I dont want to show that
to my customer, but as i said, i have no change to display my jsp-error
page instead.


So if that "feature" is not here for any other reason, i consider that
being a unlucky design for me, because i have to at least vesion my own
tiles.jar or do some dirty subclassing your tag.

I would appreciate your comment.

Greets Jörg



-----Original Message-----
From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 06. März 2003 11:57
To: Struts Users Mailing List
Subject: Re: how to catch exception using tiles thrown by e.g.
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude




Jörg Maurer wrote:




Cedric



exactly as you said, <insert> is used. despite the big try-catch block
approach, its unclear to me why error-page in web.xml doesn#t get a


try.


Additionally i searched for similar behaviour and all i found was
following "page 52 of the JSP 1.2 spec : Note: if autoFlush=true then if the contents of the initial Jsp-
Writer has been flushed to the ServletResponse output stream
then any subsequent attempt to dispatch an uncaught
exception from the offending page to an errorPage may fail.
When an error page is also indicated in the web.xml
descriptor, the JSP error page applies first, then the web.xml
page.".


You as a more experienced one than myself, does it make some sense to
the issue?



This make sense: Your page is made of several tiles. The first ones have already been compute, and so some outputs have been flushed. Then, one of the <insert ..> throw an exception. This exception is not catched

by the jsp mechanism because the output stream has already been flushed
...

Cedric



-----Original Message-----
From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]
Sent: Dienstag, 04. März 2003 18:35
To: Struts Users Mailing List
Subject: Re: how to catch exception using tiles thrown by e.g.
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude



I suppose that your exception is thrown by a <tiles:insert ...> tag


in


a jsp.
This exception is thrown by the tiles framework, which know nothing about the struts exception mechanism, so it can't be used. The


exception


is then propagated by the tag handler and reach the jsp page (the tile jsp). If there is an exception handler associated to the jsp, it is called, if there is no handler, the exception is propagated to parent page inserting this one. If the parent page have inserted the child


page


with an <insert ...>, then the <insert> catch the exception and show


it.


Normally, the jsp exception handling should work, but it appear that it





is not always the case.

A workaround is to put a big try/catch in the jsp throwing the exception ;-(. This will be improved in future versions.

Cedric

Jörg Maurer wrote:





Hi struts people!

I have really defined everywhere i think i can put an exception


handler


for servlet exception : 1.) in my base layout.jsp an <%@
errorPage='/pages/common/error/errorsGeneralHandler.jsp'%>
2.) in struts config a global exception handler
<global-exceptions>
<exception path="pages/common/error/errorsGeneralHandler.jsp"
type="javax.servlet.ServletException"/> </global-exceptions> 3.) in web.xml
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/pages/common/error/errorsGeneralHandler.jsp</location>
</error-page>


Still ServletException slip through my guards. Last know point as


stack


trace shows below is
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtil


S






t




rutsModulesImpl.java:122) , which throws ServletException but is never
catchable to me. The point is not the FileNotFound, which is pretty
clear to me, but why such exception doesn´t hit any of my error




handler.




Any hints appreciated!


2003-03-04 12:36:06 ApplicationDispatcher[] Servlet.service() for
servlet jsp threw exception
javax.servlet.ServletException: /pages/wf_category/pager_region.jsp
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:183)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDi


s






p




atcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDisp


a






t




cher.java:497)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.


j






a




va:819)
at
org.apache.jsp.wf_0005fcategory_0005fchoose$jsp._jspService(wf_0005fca


t






e




gory_0005fchoose$jsp.java:107)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:173)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDi


s






p




atcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDisp


a






t




cher.java:497)
at
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtil


S






t




rutsModulesImpl.java:122)
at
org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
at
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
at
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(Insert


T






a




g.java:818)
at
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
at
org.apache.jsp.base_0005flayout$jsp._jspService(base_0005flayout$jsp.j


a






v




a:1006)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:173)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDi


s






p




atcher.java:431)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDisp


a






t




cher.java:355)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.j


a






v




a:1033)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestPr


o






c




essor.java:269)
at
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(T


i






l




esRequestProcessor.java:249)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(Til


e






s




RequestProcessor.java:303)
at
org.apache.struts.action.RequestProcessor.processActionForward(Request


P






r




ocessor.java:401)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav


a






:




279)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1407


)


at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:496)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli


c






a




tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi


l






t




erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa


l






v




e.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa


l






v




e.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.


j






a




va:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2


3






4




7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja


v






a




:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher


V






a




lve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja


v






a




:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:4


6






8




)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv


e






.




java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor


.






j




ava:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.jav


a






:




1125)
at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
java.io.FileNotFoundException: /pages/wf_category/pager_region.jsp
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.loadJSP(IDE


J






s




pServlet.java:376)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.loadIfNecessary(IDEJspServlet.java:148)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:160)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDi


s






p




atcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDisp


a






t




cher.java:497)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.


j






a




va:819)
at
org.apache.jsp.wf_0005fcategory_0005fchoose$jsp._jspService(wf_0005fca


t






e




gory_0005fchoose$jsp.java:107)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:173)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDi


s






p




atcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDisp


a






t




cher.java:497)
at
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtil


S






t




rutsModulesImpl.java:122)
at
org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
at
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
at
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(Insert


T






a




g.java:818)
at
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
at
org.apache.jsp.base_0005flayout$jsp._jspService(base_0005flayout$jsp.j


a






v




a:1006)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletW


r






a




pper.service(IDEJspServlet.java:173)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspF


i






l




e(IDEJspServlet.java:246)
at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDE


J






s




pServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispa


t






c




her.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDi


s






p




atcher.java:431)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDisp


a






t




cher.java:355)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.j


a






v




a:1033)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestPr


o






c




essor.java:269)
at
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(T


i






l




esRequestProcessor.java:249)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(Til


e






s




RequestProcessor.java:303)
at
org.apache.struts.action.RequestProcessor.processActionForward(Request


P






r




ocessor.java:401)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav


a






:




279)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1407


)


at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:496)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli


c






a




tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi


l






t




erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa


l






v




e.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa


l






v




e.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.


j






a




va:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2


3






4




7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja


v






a




:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcher


V






a




lve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja


v






a




:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:4


6






8




)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv


e






.




java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.


j






a




va:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java


:






4




72)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor


.






j




ava:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.jav


a






:




1125)
     at java.lang.Thread.run(Thread.java:536)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to