ClasscastException: Cannot Cast org.jboss.ha.framework.server.HAPartitionImpl cannot be cast to org.jboss.ha.framework.server.HAPartitionImpl

View: New views
2 Messages — Rating Filter:   Alert me  

ClasscastException: Cannot Cast org.jboss.ha.framework.server.HAPartitionImpl cannot be cast to org.jboss.ha.framework.server.HAPartitionImpl

by djain101 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Brian Stansberry-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a list for discussing development of jboss projects; use the
user forum for user questions:

http://www.jboss.org/index.html?module=bb&op=viewforum&f=64

To answer your question, don't put a copy of jbossha.jar in WEB-INF/lib.
The one in the lib folder is already visible to your application.

On 10/16/2009 03:20 PM, djain101 wrote:

>
> 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


--
Brian Stansberry
Lead, AS Clustering
JBoss by Red Hat
_______________________________________________
jboss-development mailing list
jboss-development@...
https://lists.jboss.org/mailman/listinfo/jboss-development