2 Replies Latest reply on Feb 16, 2005 11:03 AM by rupesh agarwal

    JBoss cache Replication accrosss the node

    rupesh agarwal Newbie

      hi all
      We are trying to use the JBoss cache with REPL_SYNC and we are using the sun one as a appserver ,, while starting the cache service we are getting the following error

      Feb 15 18:35:07 DEBUG [main] cache.JBossCacheManagerImpl - before createService
      Feb 15 18:35:07 DEBUG [main] cache.JBossCacheManagerImpl - after createService
      Feb 15 18:35:07 DEBUG [main] cache.TreeCache - failed looking up TransactionMana
      ger, will not use transactions
      java.lang.ClassCastException
      at com.gepower.geps.common.cache.SunOneTransactionManagerLookup.getTrans
      actionManager(SunOneTransactionManagerLookup.java:34)
      at org.jboss.cache.TreeCache.startService(TreeCache.java:1090)
      at com.gepower.geps.common.cache.JBossCacheManagerImpl.createCacheServic
      e(JBossCacheManagerImpl.java:106)
      at com.gepower.gees.gc.common.cache.GCCacheManagerSvcImpl.init(GCCacheMa
      nagerSvcImpl.java:84)
      at com.ge.casper.common.ServiceLookupDelegate.addService(ServiceLookupDe
      legate.java:156)
      at com.ge.casper.common.ComponentManagerImpl.addService(ComponentManager
      Impl.java:331)
      at com.ge.casper.common.DOMConfigurator.configure(DOMConfigurator.java:1
      28)
      at com.ge.casper.common.DOMConfigurator.configure(DOMConfigurator.java:1
      80)
      at com.ge.casper.servlet.CasperServlet.init(CasperServlet.java:169)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
      java:921)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:81
      3)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
      t.java:3355)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
      601)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:345
      )
      at org.apache.catalina.startup.Embedded.start(Embedded.java:957)
      at com.iplanet.ias.web.WebContainer.start(WebContainer.java:426)
      at com.iplanet.ias.web.WebContainer.startInstance(WebContainer.java:514)
      at com.iplanet.ias.server.J2EERunner.confPostInit(J2EERunner.java:170)



      this is the xml file which we are using


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

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Sample TreeCache Service Configuration -->
      <!-- -->
      <!-- ===================================================================== -->






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



      jboss:service=Naming
      jboss:service=TransactionManager


      <!-- Configure the TransactionManager -->
      com.gepower.geps.common.cache.SunOneTransactionManagerLookup


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

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

      <!--
      Just used for async repl: use a replication queue
      -->
      false

      <!--
      Replication interval for replication queue (in ms)
      -->
      0

      <!--
      Max number of elements which trigger replication
      -->
      0

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

      <!-- JGroups protocol stack properties. Can also be a URL,
      e.g. file:/home/bela/default.xml

      -->



      <!-- UDP: if you have a multihomed machine,
      set the bind_addr attribute to the appropriate NIC IP address, e.g bind_addr="192.168.0.2"
      -->
      <!-- 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="45567"
      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="true"/>
      <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" />-->
      <FD_SOCK/>
      <VERIFY_SUSPECT timeout="1500"
      up_thread="false" down_thread="false"/>
      <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
      max_xmit_size="8192" 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="true" down_thread="true"/>




      <!--
      Whether or not to fetch state on joining a cluster
      -->
      true

      <!--
      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. Not supported now. -->



      <!--
      org.jboss.cache.loader.FileCacheLoader
      c:\tmp
      true
      /
      -->







      <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
      <!-- -->
      <!-- jboss.cache:service=TreeCache-->
      <!-- jboss.cache:service=TreeCache-->
      <!-- -->





      this is the SunOneTransactionManagerLookup.java

      /*
      * Created on Nov 21, 2004
      *
      * TODO To change the template for this generated file go to
      * Window - Preferences - Java - Code Style - Code Templates
      */
      package com.gepower.geps.common.cache;

      import java.lang.reflect.InvocationTargetException;

      import javax.transaction.TransactionManager;

      /**
      * @author vaidyar3 TODO To change the template for this generated type comment go to Window - Preferences - Java - Code
      * Style - Code Templates
      */
      public class SunOneTransactionManagerLookup implements org.jboss.cache.TransactionManagerLookup {

      /*
      * (non-Javadoc)
      *
      * @see org.jboss.cache.TransactionManagerLookup#getTransactionManager()
      */
      public TransactionManager getTransactionManager() throws Exception{
      // TODO Auto-generated method stub
      TransactionManager transactionManager = null;

      try {
      System.out.println("starting of the code");
      Class clazz = Class.forName("com.sun.jts.jta.TransactionManagerImpl");
      System.out.println("**********Got the Txn Manager Class**********");
      Object obj = clazz.getMethod("getTransactionManagerImpl", null).invoke(null, null);
      System.out.println("************Got the Object*************8" + obj.getClass());
      transactionManager = (TransactionManager) obj;
      System.out.println("************Got the Txn Manager*************8" + transactionManager);
      } catch (ClassNotFoundException classNotFoundException) {
      } catch (SecurityException securityException) {
      } catch (IllegalAccessException illegalAccessException) {
      } catch (InvocationTargetException invocationTargetException) {
      } catch (NoSuchMethodException noSuchMethodException) {
      }
      return transactionManager;
      }

      }


        • 1. Re: JBoss cache Replication accrosss the node
          Ben Wang Master

          Looks like you have ClassCastException in your SunOneTransactionManagerLookup. Can you post your LookUp code?

          After you get it work, are you willing to donate the code so others can use it as well? :-)

          -Ben

          • 2. Re: JBoss cache Replication accrosss the node
            rupesh agarwal Newbie

            r u talking abt SunOneTransactionManagerLookup.java the ocde is as follow



            /*
            * Created on Nov 21, 2004
            *
            * TODO To change the template for this generated file go to
            * Window - Preferences - Java - Code Style - Code Templates
            */
            package com.gepower.geps.common.cache;

            import java.lang.reflect.InvocationTargetException;

            import javax.transaction.TransactionManager;

            /**
            * @author vaidyar3 TODO To change the template for this generated type comment go to Window - Preferences - Java - Code
            * Style - Code Templates
            */
            public class SunOneTransactionManagerLookup implements org.jboss.cache.TransactionManagerLookup {

            /*
            * (non-Javadoc)
            *
            * @see org.jboss.cache.TransactionManagerLookup#getTransactionManager()
            */
            public TransactionManager getTransactionManager() throws Exception{
            // TODO Auto-generated method stub
            TransactionManager transactionManager = null;

            try {
            System.out.println("starting of the code");
            Class clazz = Class.forName("com.sun.jts.jta.TransactionManagerImpl");
            System.out.println("**********Got the Txn Manager Class**********");
            Object obj = clazz.getMethod("getTransactionManagerImpl", null).invoke(null, null);
            System.out.println("************Got the Object*************8" + obj.getClass());
            transactionManager = (TransactionManager) obj;
            System.out.println("************Got the Txn Manager*************8" + transactionManager);
            } catch (ClassNotFoundException classNotFoundException) {
            } catch (SecurityException securityException) {
            } catch (IllegalAccessException illegalAccessException) {
            } catch (InvocationTargetException invocationTargetException) {
            } catch (NoSuchMethodException noSuchMethodException) {
            }
            return transactionManager;
            }

            }