For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > March 2004 > java.lang.NoSuchMethodException: Property 'name' has no getter method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author java.lang.NoSuchMethodException: Property 'name' has no getter method
mycoward

2004-03-19, 8:46 pm

hi there,
whats wrong with this code?
thx

import org.apache.commons.beanutils.PropertyUtils;

import java.util.Map;

public class Hello {
public static void main(String[] args) throws Exception {
Map map = PropertyUtils.describe(new A("a"));
}
}

class A {
private String name;

public A(String name) {
this.name = name;
}

public A() {
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}

java.lang.NoSuchMethodException: Property 'name' has no getter method
at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j
ava:1180)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:772)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.beanutils.PropertyUtils.describe(PropertyUtils.java:368)
at Hello.main(Hello.java:7)
Exception in thread "main" Process terminated with exit code 1


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com