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