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

Brian Stansberry brian.stansberry at redhat.com
Fri Oct 16 16:30:22 EDT 2009


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



More information about the jboss-development mailing list