I have an ActionExceptionHandler (see code below) that works fine with
Struts 1.1, but bombs with a nightly build (Nov. 20th). With Struts
1.1, I get an error on on my input page that reads:
The process did not complete. Details should follow.
No row with the given identifier exists: 3, of class:
org.appfuse.persistence.Resume
With the nightly build I get:
The process did not complete. Details should follow.
javax.servlet.ServletException
at
org.apache.struts.action.RequestProcessor.processException(RequestProces
sor.java:552)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:451)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
264)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1176)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:454)
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(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.appfuse.webapp.filter.ActionFilter.doFilter(ActionFilter.java:178)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:213)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.appfuse.webapp.filter.CompressionFilter.doFilter(CompressionFilter.j
ava:80)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:213)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:553)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:78
1)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:58
9)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:666)
at java.lang.Thread.run(Thread.java:534)
Here is the code for my ActionExceptionHandler which is mapped as
follows:
<exception type="java.lang.Exception"
key="errors.general"
handler="org.appfuse.webapp.action.ActionExceptionHandler"/>
public final class ActionExceptionHandler extends ExceptionHandler {
private Log log = LogFactory.getLog(ActionExceptionHandler.class);
/**
* This method handles any java.lang.Exceptions that are not
* caught in previous classes. It will loop through and get
* all the causes (exception chain), create ActionErrors,
* add them to the request and then forward to the input.
*
* @see org.apache.struts.action.ExceptionHandler#execute
* (
* java.lang.Exception,
* org.apache.struts.config.ExceptionConfig,
* org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse
* )
*/
public ActionForward execute(Exception ex, ExceptionConfig ae,
ActionMapping mapping,
ActionForm formInstance,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException {
// if there's already errors in the request, don't process
ActionErrors errors =
(ActionErrors) request.getAttribute(Globals.ERROR_KEY);
if (errors != null) {
return null;
}
ActionForward forward =
super.execute(ex, ae, mapping, formInstance, request,
response);
ActionError error = null;
String property = null;
// log the exception to the default logger
logException(ex);
// Get the chained exceptions (causes) and add them to the
// list of errors as well
while (ex != null) {
String msg = ex.getMessage();
log.error(msg);
error = new ActionError("errors.detail", msg);
property = error.getKey();
ex = (Exception) ex.getCause();
if ((ex != null) && (ex.getMessage() != null)) {
// check to see if the child message is the same
// if so, don't store it
if (msg.indexOf(ex.getMessage()) == -1) {
storeException(request, property, error, forward);
}
} else {
storeException(request, property, error, forward);
}
}
return forward;
}
/**
* This method overrides the the ExceptionHandler's storeException
* method in order to create more than one error message.
*
* @param request - The request we are handling
* @param property - The property name to use for this error
* @param error - The error generated from the exception mapping
* @param forward - The forward generated from the input path (from
the form or exception mapping)
* @param scope - The scope of the exception mapping.
*/
protected void storeException(HttpServletRequest request,
String property, ActionError error,
ActionForward forward) {
ActionErrors errors =
(ActionErrors) request.getAttribute(Globals.ERROR_KEY);
if (errors == null) {
errors = new ActionErrors();
}
errors.add(property, error);
request.setAttribute(Globals.ERROR_KEY, errors);
}
protected void logException(Exception ex) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
log.error(sw.toString());
}
}
Should I try a more recent nightly build?
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]