Category Archives: apache-commons-beanutils

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanMap

I am trying to use below code for comparing two object values and print the mismtach:

  BeanMap map = new BeanMap(ep);
  PropertyUtilsBean propUtils = new PropertyUtilsBean();
  for (Object propNameObject : map.keySet()) {
     String propertyName = (String) propNameObject;
     Object expectedValue = propUtils.getProperty(ep, propertyName);
     Object actualValue = propUtils.getProperty(ap, propertyName);
     if (!expectedValue.equals(actualValue)) {
        WorkloadGeneratorLogger.log("> " + propertyName
              + " is different (oldValue=\"" + expectedValue
              + "\", newValue=\"" + actualValue + "\")");
     }
  }

Getting below error while using beanMap:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanMap ..................... Caused by: java.lang.ClassNotFoundException:

org.apache.commons.beanutils.BeanMap

Below is my pom.xml entries for the same:

   <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.3</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.2</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>

Not sure what is being missed here,I tried the same combination of jars suggested by below link:

java.lang.NoClassDefFoundError: org/apache/commons/collections/Transformer

http://commons.apache.org/proper/commons-beanutils/dependencies.html

Still unable to sort this out.

commons-beanutils: if set method return is this model, can’t get writeMethod [on hold]

private long payActualMoney; 

public long getPayActualMoney() {
  return this.payActualMoney;
}

public TAllocate setPayActualMoney(long payActualMoney) {
  this.payActualMoney = payActualMoney;
  setPayActualMoneyIsSet(true);
  return this;
}

PropertyUtils.getPropertyDescriptors not return payActualMoney 's writeMethod,and return an property 'setPayActualMoney'