org.apache.commons.beanutils.BeanMap failing with IllegalAccessException

1k views Asked by At

When I try to iterate over the entryset in a BeanMap, I get a

"java.lang.IllegalAccessException: Class org.apache.commons.beanutils.BeanMap can not access a member of class com.hello.Employee  with modifiers "public"  
    at org.apache.commons.beanutils.BeanMap.get(BeanMap.java:391)
    at org.apache.commons.beanutils.BeanMap$12.next(BeanMap.java:566)
    at org.apache.commons.collections.iterators.UnmodifiableIterator.next(UnmodifiableIterator.java:72)
    at org.codehaus.jackson.map.ser.std.MapSerializer.serializeFields(MapSerializer.java:232)
    at org.codehaus.jackson.map.ser.std.MapSerializer.serialize(MapSerializer.java:186)
    at org.codehaus.jackson.map.ser.std.MapSerializer.serialize(MapSerializer.java:23)
    at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610)
    at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256)
    at org.codehaus.jackson.map.ObjectWriter._configAndWriteValue(ObjectWriter.java:456)
    at org.codehaus.jackson.map.ObjectWriter.writeValueAsString(ObjectWriter.java:393)

Any idea what could be causing that?

1

There are 1 answers

0
Suneel On

Adding a public modifier to the class `com.hello.Employee' fixed the problem.