Announcement Announcement Module
No announcement yet.
Second character upper case Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Second character upper case

    I have a bean as shown in the snipper below:
    There are 2 fields:

    sECOND // the second character is upper case
    thIRD // the third character is upper case.

    In the main method() i use the following code to get the value of sECOND and thIRD property but get the error for the sECOND filed but the thIRD field is good.

    The exception I get is :
    thIRD third
    org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'sECOND' of bean class []: Bean property 'sECOND' 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(
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(

    I'm new to Spring and using version 2. Could some one tell me what I may be doing wrong.

    Thanks cbear


    package test;

    import org.springframework.beans.BeanWrapper;
    import org.springframework.beans.BeanWrapperImpl;

    public class TCase {

    private String sECOND= "sECOND";
    private String thIRD = "thIRD";

    public TCase(String second, String thIRD) {
    sECOND = second;
    this.thIRD = thIRD;

    * @param args
    public static void main(String[] args) {
    TCase tc = new TCase("second","third" );
    BeanWrapper bwComp = new BeanWrapperImpl(tc);
    System.out.println("thIRD " + bwComp.getPropertyValue("thIRD"));
    System.out.println("sECOND is "+ bwComp.getPropertyValue("sECOND"));
    }catch(Throwable th){


    public String getSECOND() {
    return sECOND;

    public void setSECOND(String second) {
    sECOND = second;

    public String getThIRD() {
    return thIRD;

    public void setThIRD(String thIRD) {
    this.thIRD = thIRD;


  • #2
    You ran into one of the special cases of the naming syntax of bean properties (as specified by the JavaBeans specification). Change the lookup to SECOND and it should work.


    • #3
      As Marten said take a look at the JavaBean spec, that should answer you questions. One point however is it doesn't matter what the property is called internally, it's the getter/setter names that are the important bit.


      • #4
        Thanks Martin/Karl. I will try it out based on the specification.