[jboss-dev] [JBoss-dev] ClasscastException: Cannot Cast org.jboss.ha.framework.server.HAPartitionImpl cannot be cast to org.jboss.ha.framework.server.HAPartitionImpl

djain101 dharmveer_jain at yahoo.com
Fri Oct 16 16:20:29 EDT 2009


Hi,

I have setup a cluster partition in Jboss and trying to retrieve HAPartition
object from ClusterPartition mbean. Below is my code:

ArrayList<MBeanServer> list = MBeanServerFactory.findMBeanServer(null);

for (MBeanServer server : list)
        {
            String onStr = "jboss:service=DefaultPartition";
            ObjectName objectName = new ObjectName(onStr);
            
            Set mbeans = server.queryMBeans(objectName, null);

            Object partitionObj = server.invoke(theName, "getHAPartition",
null, null);
            org.jboss.ha.framework.server.HAPartitionImpl partition =
(org.jboss.ha.framework.server.HAPartitionImpl) partitionObj;  //this line
throwing ClassCastException
        }

The last line in above code is throwing ClasscastException: Cannot Cast
org.jboss.ha.framework.server.HAPartitionImpl cannot be cast to
org.jboss.ha.framework.server.HAPartitionImpl

I have same version of jbossha.jar in jboss lib and war's web-inf/lib
folder. I am not sure why it is throwing classcast exception. Any help is
much appreciated. 

Thanks in advance !!!

Regards,
Dharmveer 
-- 
View this message in context: http://www.nabble.com/ClasscastException%3A-Cannot-Cast-org.jboss.ha.framework.server.HAPartitionImpl-cannot-be-cast-to-org.jboss.ha.framework.server.HAPartitionImpl-tp25927846p25927846.html
Sent from the JBoss - Dev mailing list archive at Nabble.com.




More information about the jboss-development mailing list