8 Replies Latest reply on Feb 26, 2008 8:09 AM by yrk.kaushik

    How do I configure JBossCache in JBoss-4.0.2?

    hau

      I followed the instructions described in http://docs.jboss.com/jbcache/current/TreeCache/html/ to configure a cache in jboss 4.0.2 and bind it to the JNDI tree. Here's what I actually did.
      1. copied jboss-cache.jar to server/default/lib
      2. create a new file server/default/deploy/jboss-cache.xml, which went like:
      <?xml version="1.0" encoding="UTF-8"?>

      jboss:service=invoker,type=jrmp
      jboss.cache:service=TreeCache
      MyCache
      true
      org.jboss.cache.TreeCacheMBean


      org.jboss.proxy.ClientMethodInterceptor
      org.jboss.proxy.SecurityInterceptor
      org.jboss.invocation.InvokerInterceptor


      jboss:service=invoker,type=jrmp
      jboss.cache:service=TreeCache


      3. started up jboss

      I saw on the console:
      15:52:08,329 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

      --- Packages waiting for a deployer ---
      org.jboss.deployment.DeploymentInfo@53701e45 { url=file:/E:/jboss-4.0.2/server/s
      aybot/deploy/jboss-cache.xml }
      deployer: null
      status: null
      state: INIT_WAITING_DEPLOYER
      watch: file:/E:/jboss-4.0.2/server/saybot/deploy/jboss-cache.xml
      altDD: null
      lastDeployed: 1122359611780
      lastModified: 1122359611780
      mbeans:

      --- Incompletely deployed packages ---
      org.jboss.deployment.DeploymentInfo@53701e45 { url=file:/E:/jboss-4.0.2/server/s
      aybot/deploy/jboss-cache.xml }
      deployer: null
      status: null
      state: INIT_WAITING_DEPLOYER
      watch: file:/E:/jboss-4.0.2/server/saybot/deploy/jboss-cache.xml
      altDD: null
      lastDeployed: 1122359611780
      lastModified: 1122359611780
      mbeans:

      My questions are:
      a. What do I need to do to bind a cache jboss'es jndi tree?
      b. Where do I put the cache configuration file?

      Thank you for your help.

        • 1. Re: How do I configure JBossCache in JBoss-4.0.2?
          hau

          i have a deploy/jboss-cache.xml:
          <?xml version="1.0" encoding="UTF-8"?>


          jboss:service=invoker,type=jrmp
          jboss.cache:service=TreeCache
          MyCache
          true
          org.jboss.cache.TreeCacheMBean


          org.jboss.proxy.ClientMethodInterceptor
          org.jboss.proxy.SecurityInterceptor
          org.jboss.invocation.InvokerInterceptor


          jboss:service=invoker,type=jrmp
          jboss.cache:service=TreeCache



          and a jboss-cache.xml:
          <?xml version="1.0" encoding="UTF-8"?>



          <!-- ==================================================================== -->
          <!-- Defines TreeCache configuration -->
          <!-- ==================================================================== -->

          jboss:service=Naming
          jboss:service=TransactionManager


          <!-- Configure the TransactionManager -->
          org.jboss.cache.DummyTransactionManagerLookup

          <!--
          Node locking level : SERIALIZABLE
          REPEATABLE_READ (default)
          READ_COMMITTED
          READ_UNCOMMITTED
          NONE
          -->
          REPEATABLE_READ

          <!-- Valid modes are LOCAL
          REPL_ASYNC
          REPL_SYNC
          -->
          LOCAL




          the server console still shows error:
          17:23:47,977 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

          --- Packages waiting for a deployer ---
          org.jboss.deployment.DeploymentInfo@53701e45 { url=file:/E:/jboss-4.0.2/server/s
          aybot/deploy/jboss-cache.xml }
          deployer: null
          status: null
          state: INIT_WAITING_DEPLOYER
          watch: file:/E:/jboss-4.0.2/server/saybot/deploy/jboss-cache.xml
          altDD: null
          lastDeployed: 1122369827977
          lastModified: 1122369827977
          mbeans:

          --- Incompletely deployed packages ---
          org.jboss.deployment.DeploymentInfo@53701e45 { url=file:/E:/jboss-4.0.2/server/s
          aybot/deploy/jboss-cache.xml }
          deployer: null
          status: null
          state: INIT_WAITING_DEPLOYER
          watch: file:/E:/jboss-4.0.2/server/saybot/deploy/jboss-cache.xml
          altDD: null
          lastDeployed: 1122369827977
          lastModified: 1122369827977
          mbeans:

          --- MBeans waiting for other MBeans ---
          ObjectName: jboss:service=proxyFactory,type=jrmp,target=factory
          State: CONFIGURED
          I Depend On:
          jboss:service=invoker,type=jrmp
          jboss.cache:service=TreeCache

          --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
          ObjectName: jboss.cache:service=TreeCache
          State: NOTYETINSTALLED
          Depends On Me:
          jboss:service=proxyFactory,type=jrmp,target=factory

          Is there something wrong in my jboss-cache.xml?

          • 2. Re: How do I configure JBossCache in JBoss-4.0.2?

            I'm also having this problem at the moment. The server I'm working from is the 'standard' server config.

            I also see the same behaviour under JBoss 4.0.0.

            HOWEVER - if I start up the 'all' configuration, which has another cluster already configured, then I don't get the error on the cache already configured - but when I copy in mine, same thing :( My configuration was first copied straight from the online docs, then I compared it to the one which seems to work in the 'all' server configuration. Apart from the names and the multicast info, no difference.

            Cheers,
            C

            • 3. Re: How do I configure JBossCache in JBoss-4.0.2?
              hau

              I found the solution. put both the cache configuration and the mbean defintion that binds it to the JNDI tree in one file. Name of the file has to be -service.xml in the deploy directory.

              I was able to see the cache in the JNDIView.

              Hope that solves your problem too.

              -hoki

              • 4. Re: How do I configure JBossCache in JBoss-4.0.2?

                Yup - came to the same conclusion myself on the train back home ;) I'd named mine xyzCacheService.xml - and after I'd whittled that down to being the *only* difference between that and the tc5-cache-service, I changed the name - and voilà, I had a cache ;)

                Cheers,
                C

                • 5. Re: How do I configure JBossCache in JBoss-4.0.2?

                  I'm having a similar problem, I managed to configure the cache with tree-service.xml in deploy dir. It's appears in the load as:

                  17:41:44,165 INFO [TreeCache] setting cluster properties from xml to: UDP(ip_mcast=true;ip_ttl=64;loopback=true;mcast_addr=10.1.1.4;mcast_port=45577;mcast_recv_buf_size=80000;mcast_send_buf_size=150000;ucast_recv_buf_size=80000;ucast_send_buf_size=150000):PING(down_thread=false;num_initial_members=
                  3;timeout=2000;up_thread=false):MERGE2(max_interval=20000;min_interval=10000):FD(down_thread=true;shun=true;up_thread=true):VERIFY_SUSPECT(down_thread=false;timeout=1500;up_thread=false):pbcast.NAKACK(down_thread=false;gc_lag=50;retransmit_timeout=600,1200,2400,4800;up_thread=false):pbcast.STABLE(de
                  sired_avg_gossip=20000;down_thread=false;up_thread=false):UNICAST(down_thread=false;min_threshold=10;timeout=600,1200,2400;window_size=100):FRAG(down_thread=false;frag_size=8192;up_thread=false):pbcast.GMS(join_retry_timeout=2000;join_timeout=5000;print_local_addr=true;shun=true):pbcast.STATE_TRANSF
                  ER(down_thread=false;up_thread=false)
                  17:41:44,185 INFO [TreeCache] interceptor chain is:
                  class org.jboss.cache.interceptors.CallInterceptor
                  class org.jboss.cache.interceptors.LockInterceptor
                  class org.jboss.cache.interceptors.UnlockInterceptor
                  17:41:44,185 INFO [TreeCache] cache mode is local, will not create the channel

                  When I try the following code in a client:

                  MBeanServer server=MBeanServerLocator.locate();
                  TreeCacheMBean cache;
                  try {
                  cache=(TreeCacheMBean)MBeanProxyExt.create(TreeCacheMBean.class, "jboss.cache:service=TreeCache", server);
                  cache.put("/a/b/c", "teststr", "teststr");
                  } catch (MalformedObjectNameException e) {
                  log.error("error inserting into cache", e);
                  } catch (CacheException e) {
                  log.error("error inserting into cache", e);
                  }

                  I receive the error:

                  javax.management.InstanceNotFoundException: jboss.cache:service=TreeCache is not registered.
                  org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:509)

                  Anyone has a suggestion where I'm wrong?

                  • 6. Re: How do I configure JBossCache in JBoss-4.0.2?

                    Forget me, I've mispelled the jndi name ...

                    • 7. Re: How do I configure JBossCache in JBoss-3.2.7?
                      satori

                      Hi,

                      I put both the cache configuration and the mbean defintion that binds it to the JNDI tree in one file. Name of the file treecacheservice.xml in the deploy directory.

                      treecacheservice.xml
                      --------------------------------------------------------------------------------------
                      <?xml version="1.0" encoding="UTF-8" ?>




                      jboss:service=invoker,type=jrmp
                      jboss.cache:service=TreeCache
                      MyCache true org.jboss.cache.TreeCacheMBean

                      org.jboss.proxy.ClientMethodInterceptor
                      org.jboss.proxy.SecurityInterceptor
                      org.jboss.invocation.InvokerInterceptor

                      jboss:service=invoker,type=jrmp
                      jboss.cache:service=TreeCache


                      <!-- ==================================================================== -->
                      <!-- Defines TreeCache configuration -->
                      <!-- ==================================================================== -->

                      jboss:service=Naming
                      jboss:service=TransactionManager


                      <!-- Configure the TransactionManager -->
                      org.jboss.cache.DummyTransactionManagerLookup

                      <!--
                      Node locking level : SERIALIZABLE
                      REPEATABLE_READ (default)
                      READ_COMMITTED
                      READ_UNCOMMITTED
                      NONE
                      -->
                      REPEATABLE_READ

                      <!-- Valid modes are LOCAL
                      REPL_ASYNC
                      REPL_SYNC
                      -->
                      LOCAL

                      <!-- Name of cluster. Needs to be the same for all clusters, in order
                      to find each other -->
                      TreeCache-Cluster



                      <!-- UDP: if you have a multihomed machine,
                      set the bind_addr attribute to the appropriate NIC IP address
                      -->
                      <!-- UDP: On Windows machines, because of the media sense feature
                      being broken with multicast (even after disabling media sense)
                      set the loopback attribute to true
                      -->
                      <UDP mcast_addr="228.1.2.3" mcast_port="45566" ip_ttl="64" ip_mcast="true"
                      mcast_send_buf_size="150000" mcast_recv_buf_size="80000" ucast_send_buf_size="150000"
                      ucast_recv_buf_size="80000" loopback="false" />
                      <PING timeout="2000" num_initial_members="3" up_thread="false" down_thread="false" />
                      <MERGE2 min_interval="10000" max_interval="20000" />
                      <FD shun="true" up_thread="true" down_thread="true" />
                      <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false" />
                      <pbcast.NAKACK gc_lag="50" max_xmit_size="8192" retransmit_timeout="600,1200,2400,4800" up_thread="false"
                      down_thread="false" />
                      <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false" />
                      <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false" />
                      <FRAG frag_size="8192" down_thread="false" up_thread="false" />
                      <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true" />
                      <pbcast.STATE_TRANSFER up_thread="false" down_thread="false" />



                      <!-- The max amount of time (in milliseconds) we wait until the
                      initial state (ie. the contents of the cache) are retrieved from
                      existing members in a clustered environment
                      -->
                      5000

                      <!-- Number of milliseconds to wait until all responses for a
                      synchronous call have been received.
                      -->
                      10000

                      <!-- Max number of milliseconds to wait for a lock acquisition -->
                      15000

                      <!-- Name of the eviction policy class. -->
                      org.jboss.cache.eviction.LRUPolicy

                      <!-- Specific eviction policy configurations. This is LRU -->


                      5
                      <!-- Cache wide default -->

                      5000
                      1000



                      5000
                      1000



                      5
                      4




                      org.jboss.cache.loader.bdbje.BdbjeCacheLoader
                      <!-- org.jboss.cache.loader.FileCacheLoader-->

                      location=c:\\tmp

                      true
                      /a/b/c,/all/my/objects
                      false
                      true



                      --------------------------------------------------------------------------------------


                      I am getting the following error in jboss console

                      --------------------------------------------------------------------------------------12:06:02,726 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
                      Incompletely deployed packages:
                      org.jboss.deployment.DeploymentInfo@f1714413 { url=file:/E:/jboss-3.2.7/server/default/deploy/treecacheservice.xml }
                      deployer: org.jboss.deployment.SARDeployer@55a338
                      status: Deployment FAILED reason: create operation failed for package file:/E:/jboss-3.2.7/server/default/deploy/treec
                      acheservice.xml; - nested throwable: (org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.U
                      ndeclaredThrowableException))
                      state: FAILED
                      watch: file:/E:/jboss-3.2.7/server/default/deploy/treecacheservice.xml
                      lastDeployed: 1132641298023
                      lastModified: 1132641297945
                      mbeans:
                      --------------------------------------------------------------------------------------

                      Could someone tell me what's wrong in the file.
                      Thanks

                      • 8. Re: How do I configure JBossCache in JBoss-4.0.2?
                        yrk.kaushik

                        I am using Jboss cache 2.0.0 GA. I've used the configuration file- local-eviction-cacheloader-service.xml, available under JBossCache-all-2.0.0.GA\etc\META-INF and place it in Jboss\server\default\deploy folder. But while starting the server, I am getting incomplete deployment error as shown below. Could any of you please help me out in resolving this?

                        12:01:43,095 INFO [ServiceConfigurator] Problem configuring service jboss.cache:service=TreeCache
                        org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@110195c on mbean jboss.cache:service=TreeCache; - nested throwable: (java.lang.VerifyError: (class: org/jboss/cache/config/Configuration, method: setCacheLoaderConfig signature: (Lorg/jboss/cache/config/CacheLoaderConfig;)V) Incompatible argument to function)
                        at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:698)
                        at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:332)


                        Caused by: java.lang.VerifyError: (class: org/jboss/cache/config/Configuration, method: setCacheLoaderConfig signature: (Lorg/jboss/cache/config/CacheLoaderConfig;)V) Incompatible argument to function
                        at org.jboss.cache.jmx.CacheJmxWrapper.getConfiguration(CacheJmxWrapper.java:124)
                        at org.jboss.cache.jmx.CacheJmxWrapper.setTransactionManagerLookupClass(CacheJmxWrapper.java:545)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


                        --- MBeans waiting for other MBeans ---
                        ObjectName: jboss.cache:service=TreeCache
                        State: FAILED
                        Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@110195c on mbean jboss.cache:service=TreeCache; - nested throwable: (java.lang.VerifyError: (class: org/jboss/cache/config/Configuration, method: setCacheLoaderConfig signature: (Lorg/jboss/cache/config/CacheLoaderConfig;)V) Incompatible argument to function)
                        I Depend On:
                        jboss:service=Naming
                        jboss:service=TransactionManager

                        I've placed the configuration file. Could any one of you please let me know whether I am missing any thing because of which I am getting this error.