ClasscastException when the return type is ArrayList in MXbean
Hi,
I am new to JMX.
I am writing Config MX bean. I am getting ClassCastException when calling the getKeys() method of my Config mbean whose return type is java.util.ArrayList.
In my program I was trying to call the getKeys() method of my mbean which is throwing me the following exception.
java.lang.ClassCastException: [Ljava.lang.String;
at $Proxy0.getKeys(Unknown Source)
However if I specify return type as primitive data type or String then it gets executed successfully.
I have also tried to do the following things but it didnę° worked still.
Changed the return type to java.util.Set.
Returned the empty java.util.ArrayList.
Tried to run the different mbean with same return type.
When I was debugging this, I have found that getKeys() method get executed successfully, but in my calling program it throws me the exception. In my calling program I have not even called any method after the call to getKeys() method.
I am using JDK 1.5 and deploying this bean on Standalone JMX server.
I have tried returning CompositeData, it is working fine. Does this means that I cannot return ArrayList from my mbean methods? If No then how can I achieve this?
Could you please help me to find out the problem?
Thanks & Regards,
Nitin Goel

