Hi,

I tried your example and it works just fine for me with beanutils 1.7.0, 1.8.1, 
1.8.2.
I suppose you did not post your real code, did you?

Note that if in your real code your second character of your property is 
uppercase things are not as usual. This means if your Getter is getAB() you 
cannot access it via getProperty(...,"aB") (resulting exactly in the exception 
you posted) but instead you must use getProperty(...,"AB").
As far as I know this is not a beanutils bug at all but somewhat weird within 
the javabean spec or implementation itself.

For me I try to avoid uppercase characaters at the second position of my 
properties.

Bjoern Eickvonder 




-----Ursprüngliche Nachricht-----
Von: Syed Muhammad Humayun [mailto:[email protected]]
Gesendet: Fr 13.11.2009 06:38
An: [email protected]
Betreff: Unknown property 'property1'?
 
Hi,

I defined a bean:

public class MyBean {
        private String property1;
        public String getProperty1 () { return this.property1; }
        public void setProperty1 (String property1) { this.property1 =
property1; } }

And, when I call following on 'MyBean';

...
MyBean mybean = new MyBean();
PropertyUtils.getProperty(mybean, "property1"); ...

I get following exception :

java.lang.NoSuchMethodException: Unknown property 'property1'
        at
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUti
lsBean.java:1122)
        at
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUti
lsBean.java:686)
        at
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean
.java:715)
        at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:29
0)

Why is this so? Why PropertyUtils is unable to see getter/setters for this
property?


-----------------------------------------------
S M Humayun
Software Architect, IBL Group
-----------------------------------------------
Cell : 92.321.8707783
Email (Official) : [email protected]
Email (Personal) : [email protected]
Google Talk : [email protected]
MSN : [email protected]
Yahoo : [email protected]
Skype : smhumayun
AIM : syedmohdhumayun
Blog : //citrix.hrs.com/in/smhumayun
Facebook : http://www.facebook.com/smhumayun 
Twitter : http://twitter.com/smhumayun
-----------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to