RE: Generic Error Handler
Matthew, What we do is define this in our web.xml file so that when the container gets a 500, 404, etc... error status code, I can then assign the appropriate Struts action to handle it. For example: 500 /c/systemError 404 /c/fileNotFoundError For application exceptions that occur in an action class, you could (as you have already mentioned) defined some general global exceptions handlers and then define more fine grained exception handlers as necessary (per action). hth, robert > -Original Message- > From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] > Sent: Monday, January 12, 2004 11:08 AM > To: Struts Users Mailing List > Subject: Generic Error Handler > > > I searched the archives and I must have missed it. I want to > have a generic > JSP or Servlet get invoked when an error occurs in my application. For > example, when I try to clink on a link on one of my pages I get an error > message: > > HTTP Status 500 - No action instance for path /detailSearch could > be created > > Looking at the logs it is obvious why there is an error (because I didn't > create the org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What is > the best approach to handle this type of error? I tried adding the > following to my struts-config.xml, but it is not going to the appError.jsp > page. > > > type="java.lang.Exception" > path="/appError.jsp"/> > > type="java.lang.ClassNotFoundException" > path="/appError.jsp"/> > > > > What is the best way to handle this? What about other types of > errors? Is > there a rule of thumb that everyone follows? > > Sorry for the hopefully easy (probably already asked) question. > > Matt > > > Here is an output of the logs: > > SEVERE: No action instance for path /detailSearch could be created > java.lang.ClassNotFoundException: > org.jax.mgi.mtb.wi.actions.DetailSearchAction > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClass > Loader.jav > a:1366) > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClass > Loader.jav > a:1213) > at > org.apache.struts.util.RequestUtils.applicationClass(RequestUtils. > java:207) > at > org.apache.struts.util.RequestUtils.applicationInstance(RequestUti > ls.java:23 > 1) > at > org.apache.struts.action.RequestProcessor.processActionCreate(Requ > estProcess > or.java:326) > at > org.apache.struts.action.RequestProcessor.process(RequestProcessor > .java:268) > at > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) > at > org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A > pplication > FilterChain.j > ava:284) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati > onFilterCh > ain.java:204) > > at > org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A > pplication > FilterChain.j > ava:233) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati > onFilterCh > ain.java:204) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp > erValve.ja > va:256) > at > org.apache.catalina.core.StandardValveContext.invokeNext(StandardV > alveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. > java:564) > at > org.apache.catalina.core.StandardContextValve.invokeInternal(Stand > ardContext > Valve.java:24 > 5) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardConte > xtValve.ja > va:199) > at > org.apache.catalina.core.StandardValveContext.invokeNext(StandardV > alveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. > java:564) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv > e.java:195 > ) > at > org.apache.catalina.core.StandardValveContext.invokeNext(StandardV > alveContex > t.java:151) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValv > e.java:164 > ) > at > org.apache.catalina.core.StandardValveContext.invokeNext(StandardV > alveContex > t.java:149) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. > java:564) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngine > Valve.java > :156) > at > org.apache.catalina.core.StandardValveContext.invokeNext(StandardV > alveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. > java:5
RE: Generic Error Handler
Would this be better handled in the web.xml Matt -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 11:08 AM To: Struts Users Mailing List Subject: Generic Error Handler I searched the archives and I must have missed it. I want to have a generic JSP or Servlet get invoked when an error occurs in my application. For example, when I try to clink on a link on one of my pages I get an error message: HTTP Status 500 - No action instance for path /detailSearch could be created Looking at the logs it is obvious why there is an error (because I didn't create the org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What is the best approach to handle this type of error? I tried adding the following to my struts-config.xml, but it is not going to the appError.jsp page. What is the best way to handle this? What about other types of errors? Is there a rule of thumb that everyone follows? Sorry for the hopefully easy (probably already asked) question. Matt Here is an output of the logs: SEVERE: No action instance for path /detailSearch could be created java.lang.ClassNotFoundException: org.jax.mgi.mtb.wi.actions.DetailSearchAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1366) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1213) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:23 1) at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcess or.java:326) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.j ava:233) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext Valve.java:24 5) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11P rotocol.java:696) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:677) at java.lang.Thread.run(Thread.java:534) - 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]
RE: Generic Error Handler
We generally map HTTP 400, 500, and 404 to an error handler action via the web.xml like so... 500 /Error.do 404 /InvalidUrl.do 400 /InvalidUrl.do --Norm -- Norm Deane MIS Consultant Vanderbilt University (615) 322-7855 [EMAIL PROTECTED] > -Original Message- > From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] > Sent: Monday, January 12, 2004 10:08 AM > To: Struts Users Mailing List > Subject: Generic Error Handler > > > I searched the archives and I must have missed it. I want to > have a generic JSP or Servlet get invoked when an error > occurs in my application. For example, when I try to clink > on a link on one of my pages I get an error > message: > > HTTP Status 500 - No action instance for path /detailSearch > could be created > > Looking at the logs it is obvious why there is an error > (because I didn't create the > org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What > is the best approach to handle this type of error? I tried > adding the following to my struts-config.xml, but it is not > going to the appError.jsp page. > > > type="java.lang.Exception" > path="/appError.jsp"/> > > type="java.lang.ClassNotFoundException" > path="/appError.jsp"/> > > > > What is the best way to handle this? What about other types > of errors? Is there a rule of thumb that everyone follows? > > Sorry for the hopefully easy (probably already asked) question. > > Matt > > > Here is an output of the logs: > > SEVERE: No action instance for path /detailSearch could be created > java.lang.ClassNotFoundException: > org.jax.mgi.mtb.wi.actions.DetailSearchAction > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC > lassLoader.jav > a:1366) > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC > lassLoader.jav > a:1213) > at > org.apache.struts.util.RequestUtils.applicationClass(RequestUt > ils.java:207) > at > org.apache.struts.util.RequestUtils.applicationInstance(Reques > tUtils.java:23 > 1) > at > org.apache.struts.action.RequestProcessor.processActionCreate( > RequestProcess > or.java:326) > at > org.apache.struts.action.RequestProcessor.process(RequestProce > ssor.java:268) > at > org.apache.struts.action.ActionServlet.process(ActionServlet.j > ava:1482) > at > org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:743) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:856) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt > er(Application > FilterChain.j > ava:284) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli > cationFilterCh > ain.java:204) > > at > org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt > er(Application > FilterChain.j > ava:233) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli > cationFilterCh > ain.java:204) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW > rapperValve.ja > va:256) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:564) > at > org.apache.catalina.core.StandardContextValve.invokeInternal(S > tandardContext > Valve.java:24 > 5) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardC > ontextValve.ja > va:199) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:564) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHost > Valve.java:195 > ) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContex > t.java:151) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport > Valve.java:164 > ) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContex > t.java:149) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:564) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn > gineValve.java > :156) > at > org.apache.catalina.core.StandardValveContext.invokeNext(Stand > ardValveContex > t.java:151) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel > ine.java:564) > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) > at > org.apache.coyote.tomcat5.CoyoteAdapter.service(Coyo