[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-user
Subject: [jboss-user] [JBoss Cache POJO Edition] - ClassCastException:
From: Viral Ghariwala <do-not-reply () jboss ! com>
Date: 2010-05-28 19:29:54
Message-ID: 1028808977.440171275075006739.JavaMail.jive () clearspace02 ! app ! mwc ! hst ! phx2 ! redhat ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Viral Ghariwala [http://community.jboss.org/people/viral.ghariwala] created the \
discussion
"ClassCastException: org.jboss.cache.pojo.impl.PojoCacheImpl cannot be cast to \
org.jboss.cache.pojo.PojoCache"
To view the discussion, visit: http://community.jboss.org/message/545340#545340
--------------------------------------------------------------
Friends,
I'm using Pojo Cache first time. I'm getting ClassCastException: \
org.jboss.cache.pojo.impl.PojoCacheImpl cannot be cast to \
org.jboss.cache.pojo.PojoCache while I try to retrieve an instance of PojoCache using \
following code.
> MBeanServer server = MBeanServerLocator.locateJBoss();
ObjectName on = null;
try {
on = new ObjectName("jboss.cache:service=PojoCache");
} catch (MalformedObjectNameException e) {
logger.error("The format of the string does not correspond to a valid ObjectName.", \
e); } catch (NullPointerException e) {
logger.error("An application attempts to use null in a case where an object is \
required.", e); }
PojoCacheJmxWrapperMBean cacheWrapper = (PojoCacheJmxWrapperMBean) \
MBeanServerInvocationHandler. newProxyInstance(server, on, \
PojoCacheJmxWrapperMBean.class,false);
PojoCache pojoCache = cacheWrapper.getPojoCache(); |
> >
> >
Below is the cache configuration file I'm using. This file is copied to 'deploy' \
directory of 'default' server.
> > pojocache-jboss-beans.xml ||
> <?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- First we create a Configuration object for the cache -->
<bean name="CacheConfiguration">
<!-- Externally injected services -->
<property name="runtimeConfig">
<bean name="CacheRuntimeConfiguration">
<property name="transactionManager">
<inject bean="jboss:service=TransactionManager" property="TransactionManager" />
</property>
</bean>
</property>
<property name="multiplexerStack">udp</property>
<property name="clusterName">PojoCacheCluster</property>
<property name="isolationLevel">REPEATABLE_READ</property>
<property name="cacheMode">REPL_SYNC</property>
<property name="stateRetrievalTimeout">15000</property>
<property name="syncReplTimeout">20000</property>
<property name="lockAcquisitionTimeout">15000</property>
<property name="exposeManagementStatistics">true</property>
</bean>
<bean name="PojoCacheJmxWrapper">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=PojoCache", \
exposedInterface=org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean.class, \
registerDirectly=true)</annotation> <property name="configuration">
<inject bean="CacheConfiguration" />
</property>
</bean>
</deployment> |
Please help to resolve this.
Thank you.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/545340#545340]
Start a new discussion in JBoss Cache POJO Edition at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2054]
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; \
margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: \
1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;"> <tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" \
style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: \
6px; -webkit-border-radius: 6px;"> <tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px \
solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; \
-moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; \
-webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; \
margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag \
-->
<!-- Email clients will render the images when the message is read so any \
image -->
<!-- must be made available on a public server, so that all recipients can \
load the image. -->
<a href="http://community.jboss.org/index.jspa" style="text-decoration: \
none; color: #E1E1E1">Community</a></h1> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; \
color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; \
-moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; \
-webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: \
17px; font-weight: normal;"> ClassCastException: \
org.jboss.cache.pojo.impl.PojoCacheImpl cannot be cast to \
org.jboss.cache.pojo.PojoCache </h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/viral.ghariwala">Viral \
Ghariwala</a> in <i>JBoss Cache POJO Edition</i> - <a \
href="http://community.jboss.org/message/545340#545340">View the full discussion</a> \
</span> <hr style="margin: 20px 0; border: none; background-color: #dadada; height: \
1px;">
<div class="jive-rendered-content"><p>Friends,</p><p>I'm using Pojo Cache first time. \
I'm getting ClassCastException: org.jboss.cache.pojo.impl.PojoCacheImpl cannot be \
cast to org.jboss.cache.pojo.PojoCache while I try to retrieve an instance of \
PojoCache using following code.</p><p style="min-height: 8pt; height: 8pt; padding: \
0px;"> </p><table border="1" cellpadding="3" cellspacing="0" style="width: 100%; \
border: 1px solid #000000;"><tbody><tr><td><p>MBeanServer server = \
MBeanServerLocator.locateJBoss();</p><p>ObjectName on = null;</p><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: \
8pt; height: 8pt; padding: 0px;"> </p><p>try {</p><p style="padding-left: 30px; \
"><span> </span>on = new ObjectName("jboss.cache:service=PojoCache");</p><p><span> \
</span>} catch (MalformedObjectNameException e) {</p><p style="padding-left: 30px; \
"><span> </span>logger.error("The format of the string does not correspond to a valid \
ObjectName.", e);</p><p><span> </span>} catch (NullPointerException e) {</p><p \
style="padding-left: 30px; "><span> </span>logger.error("An application attempts to \
use null in a case where an object is required.", e);</p><p><span> </span>}</p><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"><span> </span> </p><p \
style="min-height: 8pt; height: 8pt; padding: \
0px;"> </p><p>PojoCacheJmxWrapperMBean cacheWrapper = (PojoCacheJmxWrapperMBean) \
MBeanServerInvocationHandler.</p><p style="padding-left: \
330px;">newProxyInstance(server, on, PojoCacheJmxWrapperMBean.class,false);</p><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span> \
</span>PojoCache pojoCache = \
cacheWrapper.getPojoCache();</p></td></tr><tr><td></td></tr><tr><td></td></tr></tbody></table><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: \
8pt; height: 8pt; padding: 0px;"> </p><p>Below is the cache configuration file \
I'm using. This file is copied to 'deploy' directory of 'default' server.</p><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: \
8pt; height: 8pt; padding: 0px;"> </p><table border="1" cellpadding="3" \
cellspacing="0" style="border-collapse: collapse;"><tbody><tr><th align="center" \
style="background-color: #6a17e7;"><span style="color: \
#ffffff;">pojocache-jboss-beans.xml</span></th></tr><tr><td><div \
id="_mcePaste"><?xml version="1.0" encoding="UTF-8"?></div><div \
id="_mcePaste"><deployment xmlns="urn:jboss:bean-deployer:2.0"></div><div \
id="_mcePaste"> </div><div id="_mcePaste" style="padding-left: 30px; "><!-- First \
we create a Configuration object for the cache --></div><div id="_mcePaste" \
style="padding-left: 30px; "><bean name="CacheConfiguration"></div><div \
id="_mcePaste" style="padding-left: 60px; "><!-- Externally injected services \
--></div><div id="_mcePaste" style="padding-left: 60px; "><property \
name="runtimeConfig"></div><div id="_mcePaste" style="padding-left: 90px; \
"><bean name="CacheRuntimeConfiguration"></div><div id="_mcePaste" \
style="padding-left: 120px; "><property name="transactionManager"></div><div \
id="_mcePaste" style="padding-left: 150px; "><inject \
bean="jboss:service=TransactionManager" property="TransactionManager" /></div><div \
id="_mcePaste" style="padding-left: 120px; "></property></div><div \
id="_mcePaste" style="padding-left: 90px; "></bean></div><div id="_mcePaste" \
style="padding-left: 60px; "></property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="multiplexerStack">udp</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="clusterName">PojoCacheCluster</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="isolationLevel">REPEATABLE_READ</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="cacheMode">REPL_SYNC</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="stateRetrievalTimeout">15000</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="syncReplTimeout">20000</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="lockAcquisitionTimeout">15000</property></div><div id="_mcePaste" \
style="padding-left: 60px; "><property \
name="exposeManagementStatistics">true</property></div><div id="_mcePaste" \
style="padding-left: 30px; "></bean></div><div id="_mcePaste"> </div><div \
id="_mcePaste" style="padding-left: 30px; "><bean \
name="PojoCacheJmxWrapper"></div><div id="_mcePaste" style="padding-left: 60px; \
"><annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=PojoCache", \
exposedInterface=org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean.class, \
registerDirectly=true)</annotation></div><div id="_mcePaste" \
style="padding-left: 60px; "><property name="configuration"></div><div \
id="_mcePaste" style="padding-left: 90px; "><inject bean="CacheConfiguration" \
/></div><div id="_mcePaste" style="padding-left: 60px; \
"></property></div><div id="_mcePaste" style="padding-left: 30px; \
"></bean></div><div id="_mcePaste"> </div><div \
id="_mcePaste"></deployment></div></td></tr></tbody></table><p \
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Please help to \
resolve this.</p><p style="min-height: 8pt; height: 8pt; padding: \
0px;"> </p><p>Thank you.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a \
href="http://community.jboss.org/message/545340#545340">going to Community</a></p> \
<p style="margin: 0;">Start a new discussion in JBoss Cache POJO Edition at <a \
href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2054">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic