Announcement Announcement Module
Collapse
No announcement yet.
Intermittent issue with binding enum to select tag Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Intermittent issue with binding enum to select tag

    I have an issue where it seems every other deploy of my app to production results in the following exception:

    Code:
    ERROR [org.springframework.web.servlet.tags.form.SelectTag] Invalid property 'label' of bean class [com.voxeo.evolution.domain.EmployeeType]: Bean property 'label' 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.NotReadablePropertyException: Invalid property 'label' of bean class [com.voxeo.evolution.domain.EmployeeType]: Bean property 'label' 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:729)
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:721)
    at org.springframework.web.servlet.tags.form.OptionWriter.doRenderFromCollection(OptionWriter.java:216)
    at org.springframework.web.servlet.tags.form.OptionWriter.renderFromArray(OptionWriter.java:158)
    at org.springframework.web.servlet.tags.form.OptionWriter.writeOptions(OptionWriter.java:136)
    at org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:222)
    at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    at org.apache.jsp.WEB_002dINF.views.employeedir.employeeForm_jsp._jspx_meth_form_005fselect_005f0(employeeForm_jsp.java:1089)
    The enum looks like this:

    Code:
    public enum EmployeeType {
        ALL("All", "All"),
        PERS("Person", "People"),
        ZCON("Conference Room", "Conference Rooms"),
        ZFAX("Fax", "Fax Numbers"),
        ZOFF("Office", "Offices"),
        ZOTH("Other", "Other");
    
        private String label;
        private String pluralLabel;
    
        EmployeeType(String label, String pluralLabel) {
            this.label = label;
            this.pluralLabel = pluralLabel;
        }
    
        public String getLabel() {
            return label;
        }
    
        public String getPluralLabel() {
            return pluralLabel;
        }
    }
    Here's the relevant JSP snippet:

    Code:
    <form:select path="type" items="${types}" itemLabel="label"/>
    Here's the controller code where I add the enum values to the model:

    Code:
    model.addAttribute("types", EmployeeType.values());
    I'm never able to reproduce the exception locally. I've scoured the forums and google but it doesn't seem to be a common issue.

    Anyone see this before?

  • #2
    I am experiencing something very similar. Did you find a fix for this? Which application server are you using? I'm using Tomcat 6.0.35.

    Comment


    • #3
      Yes, the issue was a bug in Spring 3.1:

      https://jira.springsource.org/browse/SPR-9059

      https://jira.springsource.org/browse/SPR-8347

      Upgrading to Spring 3.1.1 fixed this issue for me.

      Comment

      Working...
      X