Announcement Announcement Module
Collapse
No announcement yet.
Bug in sellitem webapp in PR3? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug in sellitem webapp in PR3?

    I'm getting the following error when trying the sellitem app in PR3:

    Code:
    500 Servlet Exception
    org.springframework.beans.NotReadablePropertyException: Invalid property
    'flowScope.sale' of bean class [org.springframework.web.flow.execution.impl.StateContextImpl]:
    Bean property 'flowScope.sale' is not readable or has an invalid getter
    method: Does the return type of the getter match the parameter type of
    the setter?
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:634)
    	at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:535)
    	at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:513)
    	at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:514)
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:624)
    	at org.springframework.binding.expression.support.BeanWrapperEvaluator.evaluate(BeanWrapperEvaluator.java:25)
    	at org.springframework.web.flow.config.TextToTransitionCriteria$ExpressionTransitionCriteria.test(TextToTransitionCriteria.java:133)
    	at org.springframework.web.flow.Transition.matches(Transition.java:228)
    	at org.springframework.web.flow.TransitionableState.getTransition(TransitionableState.java:166)
    	at org.springframework.web.flow.TransitionableState.getRequiredTransition(TransitionableState.java:179)
    	at org.springframework.web.flow.DecisionState.doEnter(DecisionState.java:110)
    	at org.springframework.web.flow.State.enter(State.java:164)
    	at org.springframework.web.flow.Transition.execute(Transition.java:269)
    	at org.springframework.web.flow.TransitionableState.onEvent(TransitionableState.java:202)
    	at org.springframework.web.flow.execution.impl.FlowExecutionImpl.signalEvent(FlowExecutionImpl.java:317)
    Is this a known problem, or is it my configuration? I'm using Spring 1.2

  • #2
    The problem is that you don't have the ognl.jar in the WEB-INF/lib of the sellitem.war. As a result the ExpressionParserUtils will use the BeanWrapperExpressionParser instead of the OgnlExpressionParser and ${flowScope.sale.shipping} is obviously an OGNL expression and not a bean property path.

    Just putting ognl.jar (www.ognl.org) in WEB-INF/lib should fix the problem. How did you build the sellitem.war?

    Erwin

    Comment


    • #3
      Thanks, I'm bulding using build.bat. I fixed the locations for the jar files in the build.properties file and it included the jars in the built war, tested and it worked.

      thanks for explaining the problem

      Comment


      • #4
        It is the same in TSS article: http://www.theserverside.com/article...=SpringWebFlow

        <subflow-state id="enterPassengerInformation" flow="passenger">

        <attribute-mapper>
        <input value="${requestScope.passenger.id}" as="passengerId"/>
        </attribute-mapper>
        <transition on="finish" to="displayReservationVerification"/>
        </subflow-state>

        This wouldn't work in environment without OGNL.

        Although Scope implements Map, Spring's BeanWrapperImpl doesn't know where to get passanger property. It looks for a getter/setter and not into the map.

        Map map = new HashMap();
        map.put("passanger", "Ales");
        try {
        Object value = null;
        //value = Ognl.getValue("passanger", new HashMap(), map);
        value = new BeanWrapperImpl(map).getPropertyValue("passanger") ;
        System.out.println("value = " + value);
        } catch (Exception e) {
        e.printStackTrace();
        }

        org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'passanger' of bean class [java.util.HashMap]: Bean property 'passanger' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
        at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:634)
        at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:626)
        at Test.main(Test.java:32)

        So it is necessary to point out that you need OGNL in order this to work. Since BeanWrapper's ExpressionEvaluator implementation is insufficient here - and this should be mentioned.

        But it would be good if this wouldn't totaly depend on ONGL. With Spring already very powerful, it's probably not a big deal to put something similar (treating Map similar as JavaBean) in it.

        Rgds, Ales

        Comment


        • #5
          You are correct in saying that you need OGNL for that to work, we should get that clarified in the article.

          Regarding making BeanWrapper more powerfull so that it can handle things like a map, I suggest you post a request for enhancement on the Spring JIRA issue tracker.

          Erwin

          Comment

          Working...
          X