Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Spring Web Flow

Reply
 
Thread Tools Display Modes
  #1  
Old Aug 18th, 2009, 05:35 AM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default Multithreading issue

I regularly get errors in my flows when two threads hit a flow at the same time and i am stumped as to what I am doing wrong. here's a typical example

Code:
<var name="handsetModel" class="com.***.***.binding.HandsetModel"/>

<on-start>
	<set name="flowScope.cart" value="externalContext.sessionMap.cart" type="com.***.***.cart.ShoppingCart"/>
</on-start>

<action-state id="decideOnActivityType">
	<evaluate expression="flowScope.cart.getActivityTypeString()" result-type="string"/>
	<transition on="contractHandset" to="decideOnStartState"/>
	<transition on="paygHandset" to="addPaygHandset"/>
</action-state>
Error in eclipse:
Code:
java.lang.NullPointerException: target is null for method getActivityTypeString
	at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:862)
	at ognl.ASTMethod.getValueBody(ASTMethod.java:73)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTChain.getValueBody(ASTChain.java:109)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.Ognl.getValue(Ognl.java:333)
	at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
	at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
	at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
	at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
	at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
	at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Flow.start(Flow.java:535)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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:627)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:595)
Error in Browser:
Code:
exception 

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction@10fba68 targetAction = [EvaluateAction@1970991 expression = flowScope.cart.getActivityTypeString(), resultExposer = [null]], attributes = map[[empty]]] in state 'decideOnActivityType' of flow 'contractHandsetSale' -- action execution attributes were 'map[[empty]]'
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause 

org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction@10fba68 targetAction = [EvaluateAction@1970991 expression = flowScope.cart.getActivityTypeString(), resultExposer = [null]], attributes = map[[empty]]] in state 'decideOnActivityType' of flow 'contractHandsetSale' -- action execution attributes were 'map[[empty]]'
	org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
	org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
	org.springframework.webflow.engine.State.enter(State.java:194)
	org.springframework.webflow.engine.Flow.start(Flow.java:535)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause 

java.lang.NullPointerException: target is null for method getActivityTypeString
	ognl.OgnlRuntime.callMethod(OgnlRuntime.java:862)
	ognl.ASTMethod.getValueBody(ASTMethod.java:73)
	ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	ognl.SimpleNode.getValue(SimpleNode.java:210)
	ognl.ASTChain.getValueBody(ASTChain.java:109)
	ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	ognl.SimpleNode.getValue(SimpleNode.java:210)
	ognl.Ognl.getValue(Ognl.java:333)
	org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
	org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
	org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
	org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
	org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
	org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
	org.springframework.webflow.engine.State.enter(State.java:194)
	org.springframework.webflow.engine.Flow.start(Flow.java:535)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
I am using webflow 2.0.8 and ognl 2.6.9. Hitting the flow in a single threaded environment I never get any issues at all, but quite often i get exceptions firing more than one thread.
Reply With Quote
  #2  
Old Aug 18th, 2009, 11:21 AM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default Extra info

I'm starting to clutch at straws with this so i attempted the following. Rather than access the cart from session map directly in the flow i call a method that returns the cart.
Code:
<var name="handsetModel" class="com.***.***.binding.HandsetModel"/>
<on-start>
	<set name="flowScope.cart" value="proofActions.getCart(flowRequestContext)" type="com.***.***.cart.ShoppingCart"/>
</on-start>
<action-state id="decideOnActivityType">
	<evaluate expression="proofActions.isContractHandset(flowScope.cart)"/>
	<transition on="yes" to="decideOnStartState"/>
	<transition on="no" to="addPaygHandset"/>
</action-state>
Method code:
Code:
    public ShoppingCart getCart(RequestContext context){
        log.info("Method call - getCart()");
        ExternalContext ec = context.getExternalContext();
        log.info("External context: "+ec);
        SharedAttributeMap sessionMap = ec.getSessionMap();
        log.info("SessionMap: "+sessionMap);
        ShoppingCart cart = (ShoppingCart) sessionMap.get("cart");
        log.info("Cart retrieved from session: "+cart);
        return cart;
    }
Here is the error that appears in the browser:
Code:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction@a5ce92 targetAction = [SetAction@52744 name = flowScope.cart, value = proofActions.getCart(flowRequestContext), type = ShoppingCart], attributes = map[[empty]]] in state 'null' of flow 'contractHandsetSale' -- action execution attributes were 'map[[empty]]'
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction@a5ce92 targetAction = [SetAction@52744 name = flowScope.cart, value = proofActions.getCart(flowRequestContext), type = ShoppingCart], attributes = map[[empty]]] in state 'null' of flow 'contractHandsetSale' -- action execution attributes were 'map[[empty]]'
	org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
	org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
	org.springframework.webflow.engine.Flow.start(Flow.java:534)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
java.lang.NullPointerException
	org.springframework.webflow.expression.WebFlowOgnlExpressionParser$RequestContextPropertyAccessor.getProperty(WebFlowOgnlExpressionParser.java:92)
	ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
	ognl.ASTProperty.getValueBody(ASTProperty.java:92)
	ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	ognl.SimpleNode.getValue(SimpleNode.java:210)
	ognl.ASTMethod.getValueBody(ASTMethod.java:71)
	ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	ognl.SimpleNode.getValue(SimpleNode.java:210)
	ognl.ASTChain.getValueBody(ASTChain.java:109)
	ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	ognl.SimpleNode.getValue(SimpleNode.java:210)
	ognl.Ognl.getValue(Ognl.java:333)
	org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
	org.springframework.webflow.action.SetAction.doExecute(SetAction.java:75)
	org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
And here is the error that appears in Eclipse:
Code:
INFO  Method call - getCart()
INFO  External context: org.springframework.webflow.mvc.servlet.MvcExternalContext@1df3082
ERROR Servlet.service() for servlet phoenixWebApp threw exception
java.lang.NullPointerException
	at org.springframework.webflow.expression.WebFlowOgnlExpressionParser$RequestContextPropertyAccessor.getProperty(WebFlowOgnlExpressionParser.java:92)
	at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
	at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTMethod.getValueBody(ASTMethod.java:71)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTChain.getValueBody(ASTChain.java:109)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.Ognl.getValue(Ognl.java:333)
	at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
	at org.springframework.webflow.action.SetAction.doExecute(SetAction.java:75)
	at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
	at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
	at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
	at org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)
	at org.springframework.webflow.engine.Flow.start(Flow.java:534)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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:627)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:595)
INFO  SessionMap: map['cart' -> com.***.cart.ShoppingCart@19d0cf0]
INFO  Cart retrieved from session: com.***.cart.ShoppingCart@19d0cf0
To me it looks like the first thread is calling the method, but the second thread is blowing up when attempting to call it. If anyone can give me any indication as to what's causing this it would be greatly appreciated.

thanks
Reply With Quote
  #3  
Old Aug 19th, 2009, 05:04 AM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default Update

Here is my last ditched attempt to get a response, hopefully this post will show a little clearer where things are failing:

flowScope.cart is null in the following code when 2 threads are hitting the flow at exactly the same time

Code:
<var name="handsetModel" class="com.***.***.binding.HandsetModel"/>

<on-start>
	<set name="flowScope.cart" value="externalContext.sessionMap.cart" type="com.***.***.cart.ShoppingCart"/>
</on-start>

<action-state id="decideOnActivityType">
	<evaluate expression="handsetActions.isContractHandset(flowScope.cart)"/>
	<transition on="yes" to="decideOnStartState"/>
	<transition on="no" to="addPaygHandset"/>
</action-state>
here is the isContracthandset method that is called in the 'decideOnActivityType' action state:
Code:
public boolean isContractHandset(ShoppingCart cart) {
	if(cart == null){
	    log.info("cart is null");
	}
	log.info("Method call - isContractHandset(): cart "+cart);
	boolean isContractHandset = false;
	if("contractHandset".equals(cart.getActivityTypeString())){
	    isContractHandset = true;
	}
	return isContractHandset;
}
and here is the output from the log:
Code:
INFO  Session created ID: 212DFC605416E21C90791898EAD32A1C
INFO  Object added to sssion: Session ID: 212DFC605416E21C90791898EAD32A1C cart com.***.***.cart.ShoppingCart@14c7cd
INFO  Session created ID: 30C4695F2D1737D06B02F5E5B992258E
INFO  Object added to sssion: Session ID: 30C4695F2D1737D06B02F5E5B992258E cart com.***.***.cart.ShoppingCart@497536
INFO  Refreshing org.springframework.web.context.support.GenericWebApplicationContext@b4ac5c: display name [Flow ApplicationContext [contractHandsetSale]]; startup date [Wed Aug 19 09:41:12 GMT 2009]; parent: org.springframework.web.context.support.XmlWebApplicationContext@1bb60ad
INFO  Bean factory for application context [org.springframework.web.context.support.GenericWebApplicationContext@b4ac5c]: org.springframework.beans.factory.support.DefaultListableBeanFactory@70856b
INFO  Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70856b: defining beans [org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,messageSource]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@270fc4
INFO  cart is null
INFO  Method call - isContractHandset(): cart com.***.***.cart.ShoppingCart@14c7cd
INFO  Method call - isContractHandset(): cart null
I have a implemented an HttpSessionAttributeListener so I can confim that there are two shopping carts in separate sessions. It appears that I can only replicate this issue after I have restarted the server and submitted the first requests. Anybody?
Reply With Quote
  #4  
Old Aug 19th, 2009, 01:49 PM
InverseFalcon InverseFalcon is offline
Senior Member
 
Join Date: Nov 2008
Posts: 665
Default

Odd. This looks similar to this issue which was fixed with SWF 2.0.6. Maybe something similar was introduced in 2.0.8? I'd really like to know if it affects 2.0.7 as well. I'd suggest opening a JIRA ticket for this.
Reply With Quote
  #5  
Old Aug 19th, 2009, 04:54 PM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default

Thanks for the reply. I was originally using 2.0.5 and updated to 2.0.8 after seeing the JIRA you mention. I then rolled back to 2.0.6, but still got the same problem so I suspect this is a different issue.
Reply With Quote
  #6  
Old Aug 19th, 2009, 05:15 PM
InverseFalcon InverseFalcon is offline
Senior Member
 
Join Date: Nov 2008
Posts: 665
Default

Just for kicks, can you increase the max-executions for your flow-execution-repository to 2 or more and see if the issue still occurs?
Reply With Quote
  #7  
Old Aug 20th, 2009, 04:03 AM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default JIRA raised

I have raised the max executions to 2, but problem persists. Here's a link to the JIRA
Reply With Quote
  #8  
Old Sep 3rd, 2009, 03:48 AM
uttingj uttingj is offline
Junior Member
 
Join Date: Aug 2009
Posts: 7
Default

Anyone explain this behaviour?

I decided to pass in the shopping cart to the top level flow using a flow handler which is fine in a single threaded environment.
flow:
Code:
<input name="cart" type="cart.ShoppingCart" required="true" value="flowScope.cart"/>

<action-state id="decideOnActivityType">
	<evaluate expression="handsetActions.getActivityType(flowScope.cart.userSessionModel)"/>
	<transition on="contractHandset" to="decideOnStartState"/>
	<transition on="paygHandset" to="addPaygHandset"/>
</action-state>
flow handler method:
Code:
    public MutableAttributeMap createExecutionInputMap(HttpServletRequest request) {
        
        MutableAttributeMap map = null;
        
        HttpSession session = request.getSession();
        
        synchronized (session) {
        	ShoppingCart cart = (ShoppingCart) session.getAttribute("cart");
        	if(cart != null){
        		map = new LocalAttributeMap();
        		map.put("cart", cart);
        	}
        }

        return map;
    }
Problems occur when two threads hit the flow at once and I get the following error:
Code:
ognl.OgnlException: source is null for getProperty(null, "userSessionModel")
	at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1652)
	at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTChain.getValueBody(ASTChain.java:109)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTMethod.getValueBody(ASTMethod.java:71)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.ASTChain.getValueBody(ASTChain.java:109)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
	at ognl.SimpleNode.getValue(SimpleNode.java:210)
	at ognl.Ognl.getValue(Ognl.java:333)
	at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
	at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
	at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
	at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
	at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
	at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
	at org.springframework.webflow.engine.State.enter(State.java:194)
	at org.springframework.webflow.engine.Flow.start(Flow.java:535)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
	at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
	at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
	at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
	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.doPost(FrameworkServlet.java:511)
The error is complaining that flow.cart is null when trying to access userSessionModel, but how is this possible because the input mapping 'cart' is set as required and if it was null it would throw a FlowInputMappingException.

This is a show stopper and I have no idea what to do.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:18 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.