1 Reply Latest reply on Nov 27, 2007 7:27 AM by manik

    How can I register PojoCache under AS 4.2.1?

    isthisusernameavailable

      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


        • 1. Re: How can I register PojoCache under AS 4.2.1?
          manik

          So I presume you take the cofig file (edit it as per your settings, including providing the jboss.cache:service=PojoCache bit) and then placing the config file in your server/all/deploy directory?

          Do you see any other errors come up, when the AS attempts to instantiate and deploy the cache? If not, can you see the cache in the jmx-console?