View Full Version : Error submitting form: multiple _flowExecutionId error
dmfrey
Jul 21st, 2005, 10:28 PM
All,
I am getting the following error when submitting a form:
java.lang.IllegalArgumentException: The '_flowExecutionId' parameter was unexpectedly set to an array with values: array<String>['B08E8418-491A-2636-BF05-03FDD9567586', '87B3F5AA-4C78-9907-D260-EECD2B396899']; this is likely a view configuration error: make sure you submit a single string value for the '_flowExecutionId' parameter!
org.springframework.webflow.execution.ExternalEven t.verifySingleStringInputParameter(ExternalEvent.j ava:128)
org.springframework.webflow.execution.FlowExecutio nManager.getFlowExecutionId(FlowExecutionManager.j ava:502)
org.springframework.webflow.execution.FlowExecutio nManager.onEvent(FlowExecutionManager.java:399)
org.springframework.webflow.execution.FlowExecutio nManager.onEvent(FlowExecutionManager.java:384)
org.springframework.webflow.execution.servlet.Serv letFlowExecutionManager.handle(ServletFlowExecutio nManager.java:77)
org.springframework.webflow.mvc.FlowController.han dleRequestInternal(FlowController.java:137)
org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:128)
org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:44)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:684)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:625)
org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:386)
org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:355)
javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
com.opensymphony.module.sitemesh.filter.PageFilter .parsePage(PageFilter.java:118)
com.opensymphony.module.sitemesh.filter.PageFilter .doFilter(PageFilter.java:52)
No other forms in my application produce this error. The form setup is pretty straight forward. The one difference is in my FormAction, I am overriding setupForm to supply some referenceData to the form. Other than that, nothing special.
Some info about the app. At this point there isn't a whole lot to it. A couple of web flows that comprise a master-detail list, a cart and check out pages (this is where the error occurs).
The app is configured to use HttpSessionContinuations. That is all the really noteworthy stuff. BTW, I am using Spring WebFlows PR4.
Anyone run into this?
Thanks,
Dan
Keith Donald
Jul 22nd, 2005, 12:43 AM
That exception is thrown when its detected that you're accidently submitting the _flowExecutionId parameter TWICE (or more accurately, more than once). Check your view code.
Keith
dmfrey
Jul 22nd, 2005, 07:13 AM
Could this be the result of 2 submit buttons?
I am submitting the form 1 of 2 ways: submit to continue to next page in flow and submit to go back one page in the flow.
Should the back button be something other than an input type=submit?
Dan
Keith Donald
Jul 22nd, 2005, 09:21 AM
Pasting in your view code would help.
No, two submit buttons isn't the probem! It's that you're submitting the _flowExecutionId property twice on the same form!
Keith
dmfrey
Jul 22nd, 2005, 11:08 AM
I will post it when I can. I am not infront of that code right now. What would you like to see? the flow xml, the jsp?
flowExecutionId is only declared once on the page as a hidden input field.
Thanks for your help.
Dan
Keith Donald
Jul 22nd, 2005, 12:43 PM
jsp -- somethings submitting that _flowExecutionId twice -- it's coming in as a String array instead of a String.
Keith
dmfrey
Jul 22nd, 2005, 01:58 PM
Thanks Kieth, I will upload it when I get home tonight.
Dan
dmfrey
Jul 22nd, 2005, 07:05 PM
Keith,
Here is the jsp. It is just a simple form.
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<head>
<title>customer</title>
</head>
<body>
<form name="customerForm" method="post">
<input type="hidden" name="_flowExecutionId" value="<c:out value="${flowExecutionId}" />" />
<input type="hidden" name="_flowId" value="cart" />
<table width="90%" border="0" cellpadding="2" cellspacing="0" align="center">
<tr>
<td colspan="3">Please fill out your Shipping Information.</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.name">
<tr>
<td width="15%" class="label" nowrap>Name:</td>
<td width="50%" nowrap>
<input type="text" maxlength="50" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.address">
<tr>
<td class="label" nowrap>Address:</td>
<td nowrap>
<input type="text" maxlength="50" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.city">
<tr>
<td class="label" nowrap>City</td>
<td nowrap>
<input type="text" maxlength="20" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.state">
<tr>
<td class="label" nowrap>State:</td>
<td nowrap>
<input type="text" size="2" maxlength="2" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.zip">
<tr>
<td class="label" nowrap>Zip Code (5 or 9 digits):</td>
<td nowrap>
<input type="text" maxlength="9" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.phone">
<tr>
<td class="label" nowrap>Phone Number:</td>
<td nowrap>
<input type="text" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.shipping">
<tr>
<td class="label" nowrap>Shipping Information:</td>
<td nowrap>
<select name="<c:out value="${status.expression}" />" >
<option></option>
<c:forEach var="element" items="${model.shipping}">
<option <c:if test="${status.value == element}">selected</c:if>><c:out value="${element}" /></option>
</c:forEach>
</select>
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.survey">
<tr>
<td valign="top" class="label" nowrap>Survey:</td>
<td nowrap>
What do you think of this application?<br /><br />
<c:forEach var="element" items="${model.survey}">
<input type="checkbox"
name="<c:out value="${status.expression}" />"
value="<c:out value="${element}" />"
<c:if test="${status.value == element}">checked</c:if>
>
<c:out value="${element}" />
</input>
<br />
</c:forEach>
</td>
<td class="error" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3" align="right">
<input type="submit" name="_eventId_submit" value="Continue" />
<input type="submit" name="_eventId_back" value="Back" />
</td>
</tr>
</spring:bind>
</table>
</form>
</body>
</html>
Thanks again for your help.
Dan
Keith Donald
Jul 22nd, 2005, 10:03 PM
Dan,
Looks OK to me.
The only thing I can suggest is:
<input type="hidden" name="_flowId" value="cart" />
... isn't needed, as this view is participating in an existing FlowExecution already associated with a Flow definition (which _flowId identifies for the purpose of launching new flow executions.)
Still, that could not cause this problem. I don't understand it based on what I've seen so far--but it's clear the _flowExecutionId coming in the HTTP request as a String[] of 2 elements instead of a single String...
What's even weirder is based on your logs, the two _flowExecutionId values are DIFFERENT:
java.lang.IllegalArgumentException: The '_flowExecutionId' parameter was unexpectedly set to an array with values: array<String>['B08E8418-491A-2636-BF05-03FDD9567586', '87B3F5AA-4C78-9907-D260-EECD2B396899']; this is likely a view configuration error: make sure you submit a single string value for the '_flowExecutionId' parameter!
I would expect them to be the same had the view accidently submitted it twice...
Let me know if you figure out what is causing this. Perhaps a filter thats running before the request is submitted to the webflow system?
Keith
dmfrey
Jul 22nd, 2005, 10:24 PM
Keith,
That is a good thing to mention. There is a filter that is intercepting all of my requests. I am using SiteMesh as a templating engine. Could SiteMesh be interfering with, or possibly re-submitting the form? Would a new flowExecutionId be generated because of this? So far, all of my flows have been navigated with links, sending a GET request? I will look into these and report back.
Dan
dmfrey
Jul 22nd, 2005, 10:32 PM
Keith,
That seems to be the issue. I would guess that it has something to do with the SiteMesh filter and POSTing to the server. I switched my form to GET and the navigation succeeded.
I will look through the code to see if anything jumps out at me as to why another flowExecutionId being created.
Dan
UPDATE: I wasn't sure if this might have to do with whether or not the flow existed in a session or not or anything relating to the caching of the page.
klr8
Jul 23rd, 2005, 01:00 AM
The SiteMesh messes with the request when you POST to the server? If you verify that behaviour, please post a bug report for SiteMesh because that seems a pretty bad bug...
Erwin
dmfrey
Jul 24th, 2005, 12:15 PM
This had nothing to do with SiteMesh. I, however, looked a little deeper into this forum and found that there were others who encounterd the same situation. We all seemed to be posting the same question, but in different manners. I could not determine how they resolved their issues. Does anyone recall how they resolved their issue of submitting a form using POST, and receiving a class cast exception when it tries to parse the FlowExecutionId as a string, but, inactuality, it is an array.
Thanks,
Dan
klr8
Jul 25th, 2005, 02:19 PM
I don't really understand what you're saying. If it's not SiteMesh that's causing the problem, and you're positive that there is no bug in the JSP, then where is the second parameter value coming from??
The SWF samples contain HTML forms using POST, so that's not the problem either. In all other situation where we saw the String[] ClassCastException the problem was actually a bug in the JSP: 2 form fields with the same name.
Erwin
dmfrey
Jul 25th, 2005, 08:01 PM
I disabled anything having to do with sitemesh and still had the same problem.
Also, I removed any form elements that could produce a the same name, i.e. _elementId_*. I know that they are named 2 different names, but they are the most similar. All other elements are unique on the page.
All I am left with now is just a simple form that has one button and a couple of fields. The result, however, was the same.
Thanks for all your help.
Dan
klr8
Jul 26th, 2005, 02:42 AM
Could you post that simple form (i.e. the simples possible version that causes the problem)? I'll test it out and see if I can trace the problem.
Erwin
dmfrey
Jul 27th, 2005, 08:16 PM
Here it is. It is set to GET right now so that I can continue developing. I believe I have modified it slightly since the last time. It is posted previously as well.
Thanks.
Dan
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<head>
<title>customer</title>
<script src="<%= request.getContextPath() %>/scripts/validation.js" type="text/javascript"></script>
</head>
<body>
<SCRIPT TYPE="text/javascript">
function validateOnSubmit() {
var errs=0;
if( !validateTelnr( document.forms.customerForm.phone, 'phone_msg', true ) ) errs += 1;
if( !validateLength( document.forms.customerForm.state, 'state_msg', true, 2 ) ) errs += 1;
if( !validateLength( document.forms.customerForm.city, 'city_msg', true, 20 ) ) errs += 1;
if( !validateLength( document.forms.customerForm.address, 'address_msg', true, 50 ) ) errs += 1;
if( !validateLength( document.forms.customerForm.name, 'name_msg', true, 50 ) ) errs += 1;
if( errs>1 ) alert( 'There are fields which need correction before sending' );
if( errs==1 ) alert( 'There is a field which needs correction before sending' );
return (errs==0);
};
</SCRIPT>
<form name="customerForm" onsubmit="return validateOnSubmit()" method="GET">
<input type="hidden" name="_flowExecutionId" value="<c:out value="${flowExecutionId}" />" />
<table width="90%" border="0" cellpadding="2" cellspacing="0" align="center">
<tr>
<td colspan="3">Please fill out your Shipping Information.</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.name">
<tr>
<td width="15%" class="label" nowrap>Name:</td>
<td width="50%" nowrap>
<input type="text" maxlength="50" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" onchange="validateLength( this, 'name_msg', true, 50 );" />
</td>
<td id="name_msg" width="35%" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.address">
<tr>
<td class="label" nowrap>Address:</td>
<td nowrap>
<input type="text" maxlength="50" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" onchange="validateLength( this, 'address_msg', true, 50 );" />
</td>
<td id="address_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.city">
<tr>
<td class="label" nowrap>City</td>
<td nowrap>
<input type="text" maxlength="20" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" onchange="validateLength( this, 'city_msg', true, 20 );" />
</td>
<td id="city_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.state">
<tr>
<td class="label" nowrap>State:</td>
<td nowrap>
<input type="text" size="2" maxlength="2" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" onchange="validateLength( this, 'name_msg', true, 2 );" />
</td>
<td id="state_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.zip">
<tr>
<td class="label" nowrap>Zip Code (5 or 9 digits):</td>
<td nowrap>
<input type="text" maxlength="9" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" />
</td>
<td id="zip_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<spring:bind path="customer.phone">
<tr>
<td class="label" nowrap>Phone Number:</td>
<td nowrap>
<input type="text" id="<c:out value="${status.expression}" />" name="<c:out value="${status.expression}" />" value="<c:out value="${status.value}"/>" onchange="validateTelnr( this, 'phone_msg', true );" />
</td>
<td id="phone_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.shipping">
<tr>
<td class="label" nowrap>Shipping Information:</td>
<td nowrap>
<select name="<c:out value="${status.expression}" />" >
<option></option>
<c:forEach var="element" items="${model.shipping}">
<option <c:if test="${status.value == element}">selected</c:if>><c:out value="${element}" /></option>
</c:forEach>
</select>
</td>
<td id="shipping_msg" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
</spring:bind>
<tr>
<td colspan="3"></td>
</tr>
<spring:bind path="customer.survey">
<tr>
<td colspan="2" class="label" nowrap>What do you think of this application?</td>
<td id="survey_msg" valign="top" nowrap><c:out value="${status.errorMessage}" /></td>
</tr>
<tr>
<td></td>
<td nowrap>
<br />
<c:forEach var="element" items="${model.survey}">
<input type="radio"
name="<c:out value="${status.expression}" />"
value="<c:out value="${element}" />"
<c:if test="${status.value == element}">checked</c:if>
>
<c:out value="${element}" />
</input>
<br />
</c:forEach>
</td>
</tr>
</spring:bind>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3" align="right">
<input type="submit" name="_eventId_submit" value="Continue" onclick="return validateOnSubmit()" />
<input type="button" value="Back" onclick="window.location='?_flowExecutionId=<c:out value="${flowExecutionId}" />&_eventId=back'" />
</td>
</tr>
</table>
</form>
</body>
</html>
Keith Donald
Jul 27th, 2005, 09:05 PM
Looks like a jsp error to me.
Near the beginning of the form you have a _flowExecutionId hidden field.
Near the end you have a button that also passes _flowExecutionId in.
Keith
luxaeterna
Jul 27th, 2005, 09:29 PM
The only _flowExecutionId I can see near the bottom of the page is the on in the JavaScript click event of the 'Back' button, which wouldn't be relevant on a post using the 'Submit' button.
I had this same problem before and it wasn't solved in PR4, so I'm waiting for PR5 to land. If it still occurs then, I'll see if I can knock together a small test app to replicate the behaviour.
Geoff
Keith Donald
Jul 27th, 2005, 11:27 PM
I'd remove the _flowExecutionId set onclick for the back button and see if the problem goes away.
It's still a problem in any case: if you hit back, two _flowExecutionIds are going to be submitted as part of the one form.
Keith
kajism
Jul 28th, 2005, 12:35 AM
This has also happened to me and the problem was caused by form tag in jsp without explicit action attribute. So when the URL has contained the _flowExecutionId and also the form contained hidden _flowExecutionId the error occured (like mixing GET and POST parameters). The simple solution was to include action="?" into my form tag.
HTH,
Karel
luxaeterna
Jul 28th, 2005, 01:19 AM
Thanks Karel, that seems to have done the trick. Without the action attribute, it seems to be submitting both the form fields as well as whatever is in the querystring of the current page. Since in my case the form itself was retrieved using a GET and was submitted using a POST, the _formExecutionId existed in both the querystring and in a hidden field in the form.
Geoff
dmfrey
Jul 28th, 2005, 07:19 AM
Thanks everyone for your help.
kajism, I will try what you mentioned when I get home tonight.
Dan
dmfrey
Jul 30th, 2005, 04:01 PM
Thanks everyone, not having an explicit action defined seemed to be causing my problem. Once I added the action to the form, the page submitted fine.
Dan
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.