I am trying to fetch the Attribute with name "TargetedTrapDestinations" from the SNMPAgentConfig MBean.
If I print the type of the "TargetedTrapDestinations" I get
"[Lweblogic.management.configuration.SNMPTrapDestinationMBean;"
What I deduce from this is that It must be an array of "SNMPTrapDestinationMBean"
So I did the following
*************************
RemoteMBeanServer rmbServer
= home.getMBeanServer();
ObjectName beanName =
new ObjectName("mydomain:Location=myserver,Name=mydomain,Type=SNMPAgentConfig"
);
Object recvdObj = rmbServer.getAttribute(beanName,"TargetedTrapDestinations");
SNMPTrapDestinationMBean [] arr =
(SNMPTrapDestinationMBean [])recvdObj ;
*************************
I get a Class Cast Exception.....
Whereas If I get a Attribute "CommunityPrefix"
which Is of Type "String"
I am successful
ie
*******************
Object recvdObj = rmbServer.getAttribute(beanName,"CommunityPrefix");
String strVal = (String)recvdObj
*********************
So my question is What class should I typecast
for the Parameter "TargetedTrapDestinations" and
or how to find the correct class to typecast to