Announcement Announcement Module
Collapse
No announcement yet.
Phonebook sample attribute-mapper bug (preview 3) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Phonebook sample attribute-mapper bug (preview 3)

    The phonebook sample in preview 3 is busted right now, and I don't see how to fix it yet...

    The seach-flow.xml file declares the following...
    Code:
    <subflow-state id="showDetails" flow="person.Detail">
        <attribute-mapper>
            <input value="$&#123;sourceEvent.parameters.id&#125;" as="id" type="long"/>
        </attribute-mapper>
        <transition on="finish" to="executeQuery"/>
        <transition on="error" to="error"/>
    </subflow-state>
    Bring up the phonebook sample, enter in any name, and click on it. You will get the following yack on your shoes :P

    Code:
    org.springframework.beans.NotReadablePropertyException&#58; Invalid property 'sourceEvent.parameters.id' of bean class &#91;org.springframework.web.flow.execution.servlet.ServletEvent&#93;&#58; Bean property 'sourceEvent.parameters.id' is not readable or has an invalid getter method&#58; Does the return type of the getter match the parameter type of the setter?
    	org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;634&#41;
    	org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;626&#41;
    	org.springframework.binding.expression.support.BeanWrapperEvaluator.evaluate&#40;BeanWrapperEvaluator.java&#58;25&#41;
    	org.springframework.binding.support.Mapping.map&#40;Mapping.java&#58;91&#41;
    	org.springframework.binding.support.ParameterizableAttributeMapper.map&#40;ParameterizableAttributeMapper.java&#58;174&#41;
    	org.springframework.web.flow.support.ParameterizableFlowAttributeMapper.createSubflowInput&#40;ParameterizableFlowAttributeMapper.java&#58;218&#41;
    	org.springframework.web.flow.SubflowState.createSubflowInput&#40;SubflowState.java&#58;224&#41;
    	org.springframework.web.flow.SubflowState.doEnter&#40;SubflowState.java&#58;198&#41;
    	org.springframework.web.flow.State.enter&#40;State.java&#58;164&#41;
    	org.springframework.web.flow.Transition.execute&#40;Transition.java&#58;269&#41;
    	org.springframework.web.flow.TransitionableState.onEvent&#40;TransitionableState.java&#58;202&#41;
    	org.springframework.web.flow.execution.impl.FlowExecutionImpl.signalEvent&#40;FlowExecutionImpl.java&#58;317&#41;
    	org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;289&#41;
    	org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;245&#41;
    	org.springframework.web.flow.execution.servlet.ServletFlowExecutionManager.handle&#40;ServletFlowExecutionManager.java&#58;77&#41;
    	org.springframework.web.flow.mvc.FlowController.handleRequestInternal&#40;FlowController.java&#58;137&#41;
    	org.springframework.web.servlet.mvc.AbstractController.handleRequest&#40;AbstractController.java&#58;128&#41;
    	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle&#40;SimpleControllerHandlerAdapter.java&#58;44&#41;
    	org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;684&#41;
    	org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;625&#41;
    	org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;386&#41;
    	org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;346&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;689&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;802&#41;

  • #2
    Everyone runs into this. You need OGNL in your classpath :-)

    This issue is fixed / clarified for PR4 (which will likely be 1.0 RC1)

    Comment


    • #3
      Doh! I did have it in my classpath, but I didn't have the IDE set right to deploy it to the webapp...

      Thanks!

      What's interesting is if you search the forums for NotReadablePropertyException, you will get no results. I just did a quick search now for phonebook and I see other posts with the same problem. Searching the forums for NotReadablePropertyException won't return this post even :P

      Comment


      • #4
        Similar issue.

        Hi,

        I am having a similar issue (not with the PhoneBook example though). I am using Spring 1.2.6 and SWF pr5. Please have a look at the following code.

        JSP Code:
        Code:
        <spring:bind path="project.assets">
        	<select name="assets" size="6" multiple>
        	<c:forEach var="myAsset" items="${assets}">
        		<option value="<c:out value="${myAsset.id}"/>">
        			<c:out value="${myAsset.id}"/>
        		</option>
        	</c:forEach>
        	</select>
        </spring:bind>
        FormAction initBinder Code. Here I register a custom property editor.
        Code:
        	protected void initBinder(RequestContext context, DataBinder binder) {		
        		binder.registerCustomEditor(Set.class, "assets", new CustomCollectionEditor(Set.class) {
        			// converts the int id into an Asset instance, 
        			// by looking in up in the DAO
        			protected Object convertElement(Object element) {
        				Asset asset = null;
        				if (element != null) {
        					int id = new Integer((String)element);
        					asset = (Asset) projectService.getAssetById(id);
        					log.debug("Retrieved Asset (from Hibernate) with element with id:"+id+" from the formObject.");
        				}
        				return asset;
        			}
        		});
        	}
        What is annoying is that this code seems to work in the Unit Test I've written (Asset are lookup up and added to my Set<Asset> in my parent object), but not when deployed to Tomcat.

        This is the stacktrace:

        Code:
        org.apache.jasper.JasperException: Invalid property 'assets.name' of bean class [com.accenture.adsj.appstyles.web.core.business.bo.Project]: Bean property 'assets.name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
        	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
        	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:97)
        	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:961)
        	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:738)
        	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:658)
        	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
        	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
        	javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
        root cause
        
        org.springframework.beans.NotReadablePropertyException: Invalid property 'assets.name' of bean class [com.accenture.adsj.appstyles.web.core.business.bo.Project]: Bean property 'assets.name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
        	org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:387)
        	org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:379)
        	org.springframework.validation.BindException.getFieldValue(BindException.java:337)
        	org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:117)
        	org.springframework.web.servlet.tags.BindTag.doStartTagInternal(BindTag.java:115)
        I am not whether my problem is due to bad coding in the PropertyEditor, or if it has something to do with the Spring (or SWF) version I am using.
        I checked that OGNL (2.6.7) was in my classpath.

        Any help would be greatly appreciated!

        Thanks!!

        Nicolas

        Comment


        • #5
          Greetings!

          Code:
          org.apache.jasper.JasperException: Invalid property 'assets.name' of bean class [com.accenture.adsj.appstyles.web.core.business.bo.Project]: Bean property 'assets.name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
          Check your method signature. The error says that it cannot read the following property: 'assets.name'. Does this property exists in your Project business object? Is that method 'private'? How about the spelling?

          Hopes this helps,

          Curtney

          Comment


          • #6
            Hi Curtney,

            Thanks for your fast answer.

            No assets does _not_ exist in Project. My Project class has a Set<Asset>.

            The Asset class has id, name, description as member variables. It's a private attribute, and the getters/setters are auto-generated (and are OK).
            What I don't understand is that my code doesn't even use the Asset.name property...

            Thinking about it, I might have this issue because of the special binding I am trying to make. I am trying to bind the content of a multi-select list (could be a list of checkboxes as well) to a Set in my parent object (any sort of collection would be fine). I have therefore written the little binder (see the code snippet in my original posting...)...

            Any thoughts?

            Thanks!

            Nicolas

            Comment


            • #7
              Hi all,

              I solved the problem. I was actually looking in the wrong place. There was another "assets.name" somewhere else in my flow (and I didn't expect it to go there, so I didn't look). My apologies for that.

              There might still be something wrong with my propertyEditor... but at leat I can continue now.
              Thanks a lot for your support.

              Nicolas

              Comment

              Working...
              X