Announcement Announcement Module
Collapse
No announcement yet.
Class cast exception when partial page rendering! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Class cast exception when partial page rendering!

    Hi all.
    I've got class cast exception issue:

    Code:
    java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
    Here's the form code:
    Code:
    <form:form id="HRMEditForm1" modelAttribute="HRMEditForm" method="get" action="${flowExectionUrl}">
    	<form:select id="country" path="countryId" cssStyle="width:200px;">
    		<form:option id="" value=""></form:option>
    		<form:options items="${HRMEditForm.countryList}" itemValue="countryIso2" itemLabel="countryName"></form:options>
    	</form:select>
    	<script type="text/javascript">
    		Spring.addDecoration(new Spring.AjaxEventDecoration({
    			elementId: "country",
    			formId: "HRMEditForm1",
    			event: "onchange",
    			params: { _eventId: "renderAddress", fragments: "address" }
    		}));
    	</script>
    	<form:select id="city" path="cityId" cssStyle="width:200px;">
    		<form:option id="" value=""></form:option>
    		<form:options items="${HRMEditForm.cityList}" itemValue="cityId" itemLabel="cityName"></form:options>
    	</form:select>
    	<script type="text/javascript">
    		Spring.addDecoration(new Spring.AjaxEventDecoration({
    			elementId: "city",
    			formId: "HRMEditForm1",
    			event: "onchange",
    			params: { _eventId: "renderAddress", fragments: "address" }
    		}));
    	</script>
    	<form:select id="district" path="districtId" cssStyle="width:200px;" >
    		<form:option id="" value=""></form:option>
    		<form:options items="${HRMEditForm.districtList}" itemValue="id.districtId" itemLabel="districtName"></form:options>
    	</form:select>
    	<script type="text/javascript">
    		Spring.addDecoration(new Spring.AjaxEventDecoration({
    			elementId: "district",
    			formId: "HRMEditForm1",
    			event: "onchange",
    			params: { _eventId: "renderAddress", fragments: "address" }
    		}));
    	</script>
    	<form:select path="quarterId" cssStyle="width:200px;">
    		<form:option id="" value=""></form:option>
    		<form:options items="${HRMEditForm.quarterList}" itemValue="id.quarterId" itemLabel="quarterName"></form:options>
    	</form:select>
    </form:form>
    Here's the flow definition:
    Code:
    <input name="mscode"/>
    
    <on-start>
    	<set name="flowScope.HRMEditForm" value="HRMEditController.createNew()"/>
    	<set name="flowScope.hrmEditMs" value="MedicalSpecialistDAO.findById(mscode)"/>
    	<evaluate expression="flowScope.HRMEditForm.setMedicalSpecialistInfo(flowScope.hrmEditMs)" />
    	<set name="flowScope.HRMEditForm.countryList" value="CountryDAO.findAll()" />
    	<set name="flowScope.HRMEditForm.cityList" value="CityDAO.findByCountryId(flowScope.HRMEditForm.countryId)" />
    	<set name="flowScope.HRMEditForm.districtList" value="DistrictDAO.findByCityId(flowScope.HRMEditForm.cityId)" />
    	<set name="flowScope.HRMEditForm.quarterList" value="QuarterDAO.findByCityAndDistrict(flowScope.HRMEditForm.cityId, flowScope.HRMEditForm.districtId)" />
    </on-start>
    
    <view-state id="start" view="admin/hrmcpedit" model="flowScope.HRMEditForm">
    	<transition on="renderAddress">
    		<set name="flowScope.HRMEditForm.cityList" value="CityDAO.findByCountryId(flowScope.HRMEditForm.countryId)" />
    		<set name="flowScope.HRMEditForm.districtList" value="DistrictDAO.findByCityId(flowScope.HRMEditForm.cityId)" />
    		<set name="flowScope.HRMEditForm.quarterList" value="QuarterDAO.findByCityAndDistrict(flowScope.HRMEditForm.cityId, flowScope.HRMEditForm.districtId)" />
    		<render fragments="address" />
    	</transition>
    	<transition on="back" to="back" />
    </view-state>
    
    <end-state id="back">
    </end-state>
    I'm using tiles 2.0.6, spring framework 2.5.6 and web flow 2.0.7.

  • #2
    Here's the full stack trace
    Code:
    ERROR: com.eon.health.sessionmanagement - org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'start' of flow 'hrmEditSubFlow'
    DEBUG: org.springframework.web.servlet.DispatcherServlet - Could not complete request
    org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'start' of flow 'hrmEditSubFlow'
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:569)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:263)
    	at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:163)
    	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    	at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at com.eon.health.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:26)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
    	at org.springframework.web.util.WebUtils.findParameterValue(WebUtils.java:565)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.determineEventId(AbstractMvcView.java:316)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.getEventId(AbstractMvcView.java:281)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.userEventQueued(AbstractMvcView.java:190)
    	at org.springframework.webflow.engine.ViewState.resume(ViewState.java:195)
    	at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
    	... 61 more
    Jun 23, 2009 6:21:41 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet health threw exception
    java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
    	at org.springframework.web.util.WebUtils.findParameterValue(WebUtils.java:565)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.determineEventId(AbstractMvcView.java:316)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.getEventId(AbstractMvcView.java:281)
    	at org.springframework.webflow.mvc.view.AbstractMvcView.userEventQueued(AbstractMvcView.java:190)
    	at org.springframework.webflow.engine.ViewState.resume(ViewState.java:195)
    	at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    	at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
    **************** removed last parts due to 10000 character limitation

    Comment


    • #3
      More info (hopefully)

      Hi,

      I'm also using spring framework 2.5.6 and web flow 2.0.7 - no tiles though.

      It happens for me when you click too quickly on the page. It appears that several requests are somehow being lumped together for parsing.

      This is a bug in SWF I think. I have very little custom code and my config is fairly standard. The problem is reproducibility. I can get it to happen consistently by clicking quickly for fifteen or twenty seconds, but how that would work for getting it fixed I don't know.

      Does anyone have an idea for a quick fix? Can I catch the exception somewhere and just swallow it? Hmm... Any ideas would be helpful

      Stacktrace:

      Code:
      java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
      	org.springframework.web.util.WebUtils.findParameterValue(WebUtils.java:565)
      	org.springframework.webflow.mvc.view.AbstractMvcView.determineEventId(AbstractMvcView.java:316)
      	org.springframework.webflow.mvc.view.AbstractMvcView.getEventId(AbstractMvcView.java:281)
      	org.springframework.webflow.mvc.view.AbstractMvcView.userEventQueued(AbstractMvcView.java:190)
      	org.springframework.webflow.engine.ViewState.resume(ViewState.java:195)
      	org.springframework.webflow.engine.Flow.resume(Flow.java:545)
      	org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
      	org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:163)
      	org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
      	org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
      	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      Comment


      • #4
        Seems like an odd thing to see. SWF should be synchronizing on the conversation, so requests should never execute concurrently.

        Comment


        • #5
          Somehow I've fixed this issue. I've changed my code a bit. I don't know how did I solved this

          Comment


          • #6
            My Problem

            Hi,

            After looking through my configuration, I remembered that I do have an non-standard customization. In order to integrate displaytag, I used the solution given by Splashout here: http://forum.springsource.org/showthread.php?p=210899

            So now I have the question of why it (most likely) is causing a problem. The comment by InverseFalcon that it should be synchronizing on the conversation is perhaps a solution (if I knew as single thing about how to go about getting a conversation). I'll pose the question in a new thread.

            Comment


            • #7
              From the stack trace it looks like AbstractMvcView is trying to extract the eventId from the request but is getting back an array of values instead of a single string. Most likely this means somehow the request contains the eventId parameter twice. You mentioned using the displaytag library, which can duplicate parameters from the previous request when it creates links for sorting or pagination. You can use Firebug or some similar tool to verify if that is the case.

              Comment


              • #8
                Getting also a ClassCastException in FlowAjaxTilesView.getRenderFragments()

                Code:
                Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Ljava.lang.String;
                	at org.springframework.webflow.mvc.view.FlowAjaxTilesView.getRenderFragments(FlowAjaxTilesView.java:47) ~[spring-webflow-2.3.0.RELEASE.jar:2.3.0.RELEASE]
                	at org.springframework.js.ajax.tiles2.AjaxTilesView.renderMergedOutputModel(AjaxTilesView.java:85) ~[spring-js-2.3.0.RELEASE.jar:2.3.0.RELEASE]
                	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]
                	at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:50) ~[spring-webflow-2.3.0.RELEASE.jar:2.3.0.RELEASE]
                	at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:187) ~[spring-webflow-2.3.0.RELEASE.jar:2.3.0.RELEASE]
                	... 39 common frames omitted
                jsp code:
                Code:
                <a id="addProductsAndServices" href="${flowExecutionUrl}&_eventId=add">
                					<input type="button" name="add" class="button-blue">
                				</a>
                				<script type="text/javascript">
                				    Spring.addDecoration(new Spring.AjaxEventDecoration({
                				        elementId: "addProductsAndServices",
                				        event: "onclick",
                				        params: { fragments: "cart" }
                				    }));
                				</script>
                Looking at the webflow source code ClassCastException happens in:
                Code:
                String[] fragments = (String[]) context.getFlashScope().get(View.RENDER_FRAGMENTS_ATTRIBUTE);
                Having a look to the debugger shows that context.getFlashScope().get(View.RENDER_FRAGMENTS_ ATTRIBUTE) returns indeed an ArrayList object with the "cart" item. I dont have any idea why the expected fragments are of type String[] while the result of getting the fragment attribute in the flash scope is an ArrayList object. It might look like a bug.

                How to solve this?

                Notes:
                Using webflow 2.3.0, spring 3.1.0, tiles 2.1.3

                Comment

                Working...
                X