Hi,
I could finally get the execandwait interceptor to work for a file upload action in my struts2 application.
After the user selects a file and clicks submit, the wait page is displayed and then the success or error page based on the upload result.
Felt very accomplished when all this worked ..... on our development environment(
Tomcat server).
However I am now having issues trying to get the same code to work on Weblogic 10.3.
On Weblogic: After I select the file and click submit, the wait page is displayed and after the first refresh I get the nullPointerException(details below)
class java.lang.NullPointerException
Error Message:
Stack Trace:
com.actions.myAction.upload(myAction.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:57)
java.lang.Thread.run(Thread.java:619)
While debugging, I see that everytime the wait page is refreshed, the control actually goes into myAction class which is not how the execAndWait interceptor is supposed to work (??)
Can anyone please help me with this?
What is the difference in the way the execAndWaitInterceptor works on Tomcat and Weblogic?
Note: Without the execAndWait interceptor, the file upload utility works fine on Weblogic too.
struts.xml
<action name=myAction"
class="myActionClass" method="myMethod">
<interceptor-ref name="completeStack" />
<interceptor-ref name="execAndWait">
<param name="delay">1000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
<result name="wait">/WEB-INF/pages/wait.jsp</result>
<result name="success">/WEB-INF/pages/success.jsp</result>
<result name="input">/WEB-INF/pages/inputPage.jsp</result>
</action>
wait.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="refresh" content="5;url=<s:url includeParams="all" />"/>
</head>
<body>
<h1>
Struts 2 execAndWait example</h1>
<h3>Please wait ...</h3>
</body>
</html>
TIA