- This topic has 8 replies, 2 voices, and was last updated 13 years, 6 months ago by
Greg Soulsby.
-
AuthorPosts
-
Greg SoulsbyMemberI have the webflow based scaffolding working now.
Trying to add an extra expression to a transition. It looks fine to me (which doesnt carry much weight) in both the diagram and xml – see below. But getting “java.lang.NoSuchMethodException”. Nothing I have tried helps. Have seen in some forum posts on this error type a conversation about Java versions. I am just using whatever you download from within Ubuntu, v 1.6.
<transition on=”edit” to=”editInnovCatalogues”>
<evaluate expression=”InnovCataloguesDAO.findInnovCataloguesByPrimaryKey(requestParameters.catalogueIdKey)” result=”flowScope.innovCatalogues” result-type=””/>
<set name=”catalogue_children” type=”” value=”zzz_catalogue.create_catalogue_children(requestParameters.catalogueIdKey)”/>
</transition>11-Aug-2011 09:19:21 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet WebFlow Servlet threw exception
java.lang.NoSuchMethodException: create_catalogue_children(java.lang.String)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:824)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:61)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:860)
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.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.support.ActionTransitionCriteria.test(ActionTransitionCriteria.java:82)
at org.springframework.webflow.engine.support.TransitionCriteriaChain.test(TransitionCriteriaChain.java:71)
at org.springframework.webflow.engine.Transition.canExecute(Transition.java:195)
at org.springframework.webflow.engine.Transition.execute(Transition.java:211)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:391)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
at org.springframework.webflow.engine.TransitionableState.handleEvent(TransitionableState.java:119)
at org.springframework.webflow.engine.Flow.handleEvent(Flow.java:555)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleEvent(FlowExecutionImpl.java:386)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.handleEvent(RequestControlContextImpl.java:210)
at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:230)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:163)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
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 com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
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(Thread.java:619)
jayperkinsMemberHi,
What type of class is the variable zzz_catalogue? Does that class have a method named create_catalogue_children that takes a single string parameter? That looks to be what it is complaining about – it can’t find that method with that signature on the class that is represented by the zzz_catalogue variable.
Thanks,
Jay
Greg SoulsbyMemberok, what you say must be right, that is what it was saying. But now in testing I cant re-produce that problem, so I dont know what it was.
Now I am getting the next issue: When I have a proprietary function within a ME scaffolded class there is no problem. But when I have my own POJO I am getting
“java.lang.NullPointerException: target is null for method getTest”
so it looks like my own class it is not be initialised? When you want to use your own POJO in a flow expression, what do you have to do to set it up?
My test class is below, as well as the transition xml
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.FetchType;
import javax.xml.bind.annotation.XmlElement;public class zzz_prop implements Serializable {
@Basic(fetch = FetchType.EAGER)
@XmlElement
Integer test;public void setTest(Integer test) {this.test = test; }
public Integer getTest() { return 11; }
public zzz_prop() { System.out.println(“in zzz_prop”);}
}<transition on=”edit” to=”editInnovCatalogues”>
<evaluate expression=”InnovCataloguesDAO.findInnovCataloguesByPrimaryKey(requestParameters.catalogueIdKey)” result=”flowScope.innovCatalogues” result-type=””/>
<evaluate expression=”InnovCataloguesDAO.catalogueChildren(requestParameters.catalogueIdKey)” result=”flowScope.catalogueChildren” result-type=””/>
<evaluate expression=”zzz_prop.getTest(requestParameters.catalogueIdKey)” result=”flowScope.zzz_prop_result” result-type=””/>
jayperkinsMemberHi,
You can create an instance of your pojo with an <evaluate> element like so:
org.blah.service<evaluate expression=”new org.yourpackage.zzz_prop()” result=”flowScope.zzz_prop” result-type=””/>
You will have to decide where you want this instantiated. For example, you may want the zzz_prop variable initialized when the webflow starts. Then the above <evaluate> element may be a child of the <on-start> element.
Let me know if you still have questions.
Thanks,
Jay
Greg SoulsbyMemberGet that, thanks.
What tricked me is that I cant see the scaffolded classes having that, or that the functions are static.
Can you explain why the scaffolded classed dont have a new like that?
Thanks
jayperkinsMemberMost of the classes that we call methods on are beans that are instantiated and managed by spring (like the service and dao).
So when you see something like this InnovCataloguesDAO.catalogueChildren() we are accessing the InnovCataloguesDAO by its bean name and calling the appropriate method.
Does that make sense?
Greg SoulsbyMemberSo can you point me to, or explain, how I can have my POJO managed by Spring as well?
jayperkinsMemberLook at your ServiceImpl class. You can just annotate your pojo with the @Service(“mypojo”) annotation. Then you will be able to access it in your webflow using mypojo.myMethod().
You have to make sure your class is picked up by Spring’s annotation scanner. If it is in a different package than your service you will have to add the following to your YOurProject-service.xml spring config file in your resources directory.
<context:component-scan base-package=”org.blah.mypojo” scoped-proxy=”interfaces” />
Greg SoulsbyMembervery helpful, thanks
-
AuthorPosts