<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br>Hi,<br><br>I have setup a cluster partition in Jboss and trying to retrieve HAPartition<br>object from ClusterPartition mbean. Below is my code:<br><br><span style="font-style: italic;">ArrayList&lt;MBeanServer&gt; list = MBeanServerFactory.findMBeanServer(null);</span><br style="font-style: italic;"><br style="font-style: italic;"><span style="font-style: italic;">for (MBeanServer server : list)</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String onStr = "jboss:service=DefaultPartition";</span><br style="font-style: italic;"><span style="font-style:
 italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectName objectName = new ObjectName(onStr);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set mbeans = server.queryMBeans(objectName, null);</span><br style="font-style: italic;"><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object partitionObj = server.invoke(theName, "getHAPartition",</span><br style="font-style: italic;"><span style="font-style: italic;">null, null);</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; org.jboss.ha.framework.server.HAPartitionImpl partition
 =</span><br style="font-style: italic;"><span style="font-style: italic;">(org.jboss.ha.framework.server.HAPartitionImpl) partitionObj;&nbsp; //this line</span><br style="font-style: italic;"><span style="font-style: italic;">throwing ClassCastException</span><br style="font-style: italic;"><span style="font-style: italic;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br><br>The last line in above code is throwing ClasscastException: Cannot Cast<br>org.jboss.ha.framework.server.HAPartitionImpl cannot be cast to<br>org.jboss.ha.framework.server.HAPartitionImpl<br><br>I have same version of jbossha.jar in jboss lib and war's web-inf/lib<br>folder. I am not sure why it is throwing classcast exception. Any help is<br>much appreciated. <br><br>Thanks in advance !!!<br><br>Regards,<br>Dharmveer <br></div><br>
      <!--7--><hr size=1></hr> Yahoo! India has a new look. <a href="http://in.rd.yahoo.com/tagline_metro_2/*http://in.yahoo.com/trynew" target="_blank"> Take a sneak peek</a>.</body></html>