File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Error at RequestProcessor processActionPerform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error at RequestProcessor processActionPerform" Watch "Error at RequestProcessor processActionPerform" New topic
Author

Error at RequestProcessor processActionPerform

Nandu Arni
Greenhorn

Joined: Jan 26, 2002
Posts: 8
Very frquently I am getting this exception when I click any link, if I re-login then i don't see error again. Here is the exception and I am also writing execute() of my DispatchAction class here. please advice me where is the error and how to solve this.



2005-05-05 19:10:48 StandardWrapperValve[ActionServlet]: Servlet.service() for servlet ActionServlet threw exception
java.lang.NullPointerException
at com.mrll.struts.apex.framework.DispatchAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)

-----------------------
EXECUTE METHOD OF MY DISPATCH ACTION.

public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

Throwable throwable = null;
ActionForward actionForward = null;

try {
initialize(mapping, form, request, response);

Object[] parameters = new Object[] {mapping, form, request, response};
String methodName = mapping.getParameter();

if ((methodName == null) || methodName.equalsIgnoreCase("")) {
throw new NoSuchMethodException(methodName);
}

//As per the Merrill's request, we have added 'execute' keyword infront of the method name
//In struts-config, parameter attributes doesn't have 'execute' keyword
methodName = EXECUTE + methodName;

// Try to find a method on this object of the specified name
Method method = getClass().getMethod(methodName, PARAMETER_TYPES);

if (method == null) {
throw new NoSuchMethodException(methodName);
}

// Invoke the named method on the current object
actionForward = (ActionForward) method.invoke(this, parameters);
} catch (InvocationTargetException e) {
throwable = e.getTargetException();
actionForward.setName(ApexForwardMappings.FAILURE);
} catch (Exception e) {
throwable = e;
e.printStackTrace();
actionForward.setName(ApexForwardMappings.FAILURE);
} finally {

if (throwable != null) {
request.setAttribute(REQUEST_ATTRIBUTE_EXCEPTION, throwable);
}

cleanup(mapping, form, request, response, actionForward);
}

return mapping.findForward(actionForward.getName());
}
hello_nandu@yahoo.com
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Your catch blocks include:
actionForward.setName(...
but won't actionForward be null if an exception occurred?


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error at RequestProcessor processActionPerform