[jboss-user] [JBossCache] - How can I register PojoCache under AS 4.2.1?
isthisusernameavailable
do-not-reply at jboss.com
Wed Nov 21 12:56:36 EST 2007
Hello,
I'm a newbie trying to get JBoss Cache working under a AS 4.2.1 cluster. I'm hoping our forum gurus can help me register a cluster-wide PojoCache correctly.
Here's my setup.
1. Install AS 4.2.1 successfully.
2. Download JBossCache-1.4.1.SP6.
3. Change JBossCache-1.4.1.SP6/etc/META-INF/pojocache-service.xml to use JBossTransactionManagerLookup instead of DummyTransactionManagerLookup.
4. Copy the modified JBossCache-1.4.1.SP6/etc/META-INF/pojocache-service.xml to <JBOSS_HOME>/server/all/deploy.
5. Start JBoss in "-c all" server mode.
6. Create a stateless bean that has this code in its @PostConstruct method:
MBeanServer server = MBeanServerLocator.locateJBoss();
| cache = (PojoCacheMBean)MBeanProxyExt.create(PojoCacheMBean.class, "jboss.cache:service=PojoCache,cacheType=Cache", server);
(Similar to what's shown in http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/cache/Cache_Frequently_Asked_Questions/tree_cache.html#a12)
7. In my business method, try to access the cache to find a @PojoCacheable CacheItem
CacheItem item = (CacheItem)m_cache.getObject(name);
This throws the following exception in my server.log:
javax.management.InstanceNotFoundException: jboss.cache:service=PojoCache is not registered.
|
So my questions are:
1. Am I using the correct .xml file to configure PojoCache? It seems odd that I need to download the .4.1.SP6 distro just to get a config file, when AS 4.2.1 apparently already has the necessary libraries, so perhaps I'm not using the correct configuration xml file.
2. Assuming I'm using the correct xml file, what step am I missing to register the PojoCache service?
3. Am I accessing the cluster-wide PojoCache correctly with the create() method above? Is there a way to access it with a JDK5 annotation like @Resource?
Thanks in advance,
John
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106844#4106844
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106844
More information about the jboss-user
mailing list