This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes about beanutils Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "about beanutils" Watch "about beanutils" New topic

about beanutils

chen feng

Joined: Jun 22, 2007
Posts: 1
i have some problem about common-beanutils.jar

i use beanutils's static method, but all of them throw Exception.

just like:

public class MyCopy {
public static void main(String[] args) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
Book book1 = new Book();
book1.setName("Jakarta Commons Cookbook");
Book book2 = new Book();

book2 = (Book)BeanUtils.cloneBean(book1);
// System.out.println(BeanUtils.getProperty(book1, "name"));

class Book {
private String name = "";

public String getName() {
return name;

public void setName(String name) { = name;


both of cloneBean and getProperty throw Exception.

Exception in thread "main" java.lang.IllegalAccessException: Class org.apache.commons.beanutils.BeanUtilsBean can not access a member of class my.test.Book with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(
at java.lang.Class.newInstance0(
at java.lang.Class.newInstance(
at org.apache.commons.beanutils.BeanUtilsBean.cloneBean(
at org.apache.commons.beanutils.BeanUtils.cloneBean(
at my.test.MyCopy.main(

Exception in thread "main" java.lang.NoSuchMethodException: Property 'name' has no getter method
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(
at org.apache.commons.beanutils.BeanUtilsBean.getNestedProperty(
at org.apache.commons.beanutils.BeanUtilsBean.getProperty(
at org.apache.commons.beanutils.BeanUtils.getProperty(
at my.test.MyCopy.main(

help me
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

class Book {

Shouldn't this class be public, so that this is accessible to the BeanUtils.

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: about beanutils
jQuery in Action, 3rd edition