[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;">&#160;</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;">&#160;</p><p style="min-height: \
8pt; height: 8pt; padding: 0px;">&#160;</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>&#160;</p><p \
style="min-height: 8pt; height: 8pt; padding: \
0px;">&#160;</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;">&#160;</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;">&#160;</p><p style="min-height: \
8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p style="min-height: \
8pt; height: 8pt; padding: 0px;">&#160;</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">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</div><div \
id="_mcePaste">&lt;deployment xmlns="urn:jboss:bean-deployer:2.0"&gt;</div><div \
id="_mcePaste"> </div><div id="_mcePaste" style="padding-left: 30px; ">&lt;!-- First \
we create a Configuration object for the cache --&gt;</div><div id="_mcePaste" \
style="padding-left: 30px; ">&lt;bean name="CacheConfiguration"&gt;</div><div \
id="_mcePaste" style="padding-left: 60px; ">&lt;!-- Externally injected services \
--&gt;</div><div id="_mcePaste" style="padding-left: 60px; ">&lt;property \
name="runtimeConfig"&gt;</div><div id="_mcePaste" style="padding-left: 90px; \
">&lt;bean name="CacheRuntimeConfiguration"&gt;</div><div id="_mcePaste" \
style="padding-left: 120px; ">&lt;property name="transactionManager"&gt;</div><div \
id="_mcePaste" style="padding-left: 150px; ">&lt;inject \
bean="jboss:service=TransactionManager" property="TransactionManager" /&gt;</div><div \
id="_mcePaste" style="padding-left: 120px; ">&lt;/property&gt;</div><div \
id="_mcePaste" style="padding-left: 90px; ">&lt;/bean&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="multiplexerStack"&gt;udp&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="clusterName"&gt;PojoCacheCluster&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="isolationLevel"&gt;REPEATABLE_READ&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="cacheMode"&gt;REPL_SYNC&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="stateRetrievalTimeout"&gt;15000&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="syncReplTimeout"&gt;20000&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="lockAcquisitionTimeout"&gt;15000&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property \
name="exposeManagementStatistics"&gt;true&lt;/property&gt;</div><div id="_mcePaste" \
style="padding-left: 30px; ">&lt;/bean&gt;</div><div id="_mcePaste"> </div><div \
id="_mcePaste" style="padding-left: 30px; ">&lt;bean \
name="PojoCacheJmxWrapper"&gt;</div><div id="_mcePaste" style="padding-left: 60px; \
">&lt;annotation&gt;@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=PojoCache", \
exposedInterface=org.jboss.cache.pojo.jmx.PojoCacheJmxWrapperMBean.class, \
registerDirectly=true)&lt;/annotation&gt;</div><div id="_mcePaste" \
style="padding-left: 60px; ">&lt;property name="configuration"&gt;</div><div \
id="_mcePaste" style="padding-left: 90px; ">&lt;inject bean="CacheConfiguration" \
/&gt;</div><div id="_mcePaste" style="padding-left: 60px; \
">&lt;/property&gt;</div><div id="_mcePaste" style="padding-left: 30px; \
">&lt;/bean&gt;</div><div id="_mcePaste"> </div><div \
id="_mcePaste">&lt;/deployment&gt;</div></td></tr></tbody></table><p \
style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Please help to \
resolve this.</p><p style="min-height: 8pt; height: 8pt; padding: \
0px;">&#160;</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