Announcement Announcement Module
Collapse
No announcement yet.
NotReadablePropertyException with Spring 1.1 final Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NotReadablePropertyException with Spring 1.1 final

    Hi,
    after I had upgraded my webapp from Spring 1.1 RC1 to 1.1 final, I got the following exception when displaying a jsp:

    Code:
    org.springframework.beans.NotReadablePropertyException: Invalid property 'account.address.command' of bean class [webapp.model.account.Address]: Property 'account.address.command' is not readable
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:503)
    	at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:423)
    	at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:401)
    	at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:402)
    	at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:402)
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:495)
    	at org.springframework.validation.BindException.getFieldValue(BindException.java:295)
    	at org.springframework.web.servlet.support.BindStatus.<init>&#40;BindStatus.java&#58;115&#41;
    	at org.springframework.web.servlet.tags.BindStatus.<init>&#40;BindStatus.java&#58;38&#41;
    	at org.springframework.web.servlet.tags.BindTag.doStartTagInternal&#40;BindTag.java&#58;105&#41;
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag&#40;RequestContextAwareTag.java&#58;70&#41;
    	at org.apache.jsp.WEB_002dINF.jsp.pages.signon_jsp._jspService&#40;signon_jsp.java&#58;319&#41;
    	at org.apache.jasper.runtime.HttpJspBase.service&#40;HttpJspBase.java&#58;94&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;802&#41;
    	at org.apache.jasper.servlet.JspServletWrapper.service&#40;JspServletWrapper.java&#58;324&#41;
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile&#40;JspServlet.java&#58;292&#41;
    	at org.apache.jasper.servlet.JspServlet.service&#40;JspServlet.java&#58;236&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;802&#41;
    The jsp code (snippet):

    Code:
    ...
    <form method="post">
        <%-- Address --%>
        <spring&#58;nestedPath path="command.account.address">
            <%@ include file="/WEB-INF/jsp/common/address.jsp" %>
        </spring&#58;nestedPath>
    <%-- Account --%>
        <spring&#58;nestedPath path="command.account">
            <p>email&#58;<spring&#58;bind path="email"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>"/></spring&#58;bind></p>
            <p>username&#58;<spring&#58;bind path="username"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>"/></spring&#58;bind></p>
            <p>password&#58;<spring&#58;bind path="password"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>"/></spring&#58;bind></p>
        </spring&#58;nestedPath>
    ....
    address.jsp:

    Code:
    p>firstName&#58;<spring&#58;bind path="firstName"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>"/></spring&#58;bind></p>
    <p>lastName&#58;<spring&#58;bind path="lastName"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>"/></spring&#58;bind></p>
    <p>street&#58;<spring&#58;bind path="street"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>"</spring&#58;bind></p>
    <p>zip&#58;<spring&#58;bind path="zip"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>"/></spring&#58;bind></p>
    <p>city&#58;<spring&#58;bind path="city"><input type="text" name="<c&#58;out value="$&#123;status.expression&#125;"/>" value="<c&#58;out value="$&#123;status.value&#125;"/>"/></spring&#58;bind></p>
    The path (property) for the command Address is 'command.account.address', but the exception says the property is 'account.address.command'.

    Same code works fine with 1.1RC1.

    Any ideas?

    After debugging the BindTag class I'm figured out, that the nestedPath for the address object works fine. But the resolvedPath for the second nestedPath (in jsp 'commad.account') is 'command.account.address.command.account.email' (nestedPath in BindTag.doStartInternal is 'command.account.address.command.account').

    thx,
    markus

  • #2
    After further debugging...

    I am not sure, but I think it's a bug in NestedPathTag.java.

    In the method doEndTag() the call
    Code:
    pageContext.setAttribute&#40;NESTED_PATH_VARIABLE_NAME, this.previousNestedPath&#41;;
    should IMO be
    Code:
    pageContext.setAttribute&#40;NESTED_PATH_VARIABLE_NAME, this.previousNestedPath, PageContext.REQUEST_SCOPE&#41;;
    PageContext.setAttribute(...) without scope writes in PageContext.PAGE_SCOPE and in NestedPathTag.doStartTag() the call is PageContext.getAttribute(..., PageContext.REQUEST_SCOPE).

    Already posted an issue.

    markus

    Comment


    • #3
      Indeed, that's a bug that slipped into 1.1 final, with the scope recently changed from page to request (to allow for includes). Unfortunately, this hasn't been noticed in the test suite, because the MockPageContext implementation didn't properly separate individual scopes...

      Thanks for spotting this! Feel free to give a current CVS version of NestedPathTag a try...

      Juergen

      Comment

      Working...
      X