0 Replies Latest reply on Feb 23, 2009 10:31 AM by sridhar reddy

    Error when external JGroups file is linked

    sridhar reddy Newbie


      I have the following jboss cache xml as below

      <?xml version="1.0" encoding="UTF-8"?>
      <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="urn:jboss:jbosscache-core:config:3.0">
      
       <locking isolationLevel="READ_COMMITTED"
       lockParentForChildInsertRemove="false" lockAcquisitionTimeout="20000"
       nodeLockingScheme="mvcc" writeSkewCheck="false"
       concurrencyLevel="500" />
       <transaction
       transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
       syncRollbackPhase="false" syncCommitPhase="false" />
      
       <eviction wakeUpInterval="500">
       <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
       eventQueueSize="200000">
       <property name="maxNodes" value="5000" />
       <property name="timeToLive" value="1000" />
       </default>
       <region name="/org/jboss/data1">
       <property name="timeToLive" value="2000" />
       </region>
       <region name="/org/jboss/data2"
       algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm"
       eventQueueSize="100000">
       <property name="maxNodes" value="3000" />
       <property name="minTimeToLive" value="4000" />
       </region>
       </eviction>
       <clustering mode="replication" >
       <jgroupsConfig configFile="C:/workspace/GridJBCache3/src/config/jgroups.xml" />
       </clustering>
      
       <loaders passivation="false" shared="false">
       <preload>
       <node fqn="/" />
       </preload>
      
       <loader class="org.jboss.cache.loader.JDBCCacheLoader"
       async="true" fetchPersistentState="true" ignoreModifications="true"
       purgeOnStartup="true">
      
       <properties>
       cache.jdbc.table.name=jbosscache
       cache.jdbc.table.create=true
       cache.jdbc.table.drop=false
       cache.jdbc.table.primarykey=jbosscache_pk
       cache.jdbc.fqn.column=fqn
       cache.jdbc.fqn.type=varchar(255)
       cache.jdbc.node.column=node
       cache.jdbc.node.type=bytea
       cache.jdbc.parent.column=parent
       cache.jdbc.driver=org.postgresql.Driver
       cache.jdbc.url=jdbc:postgresql://localhost:5432/facts7
       cache.jdbc.user=f7tms
       cache.jdbc.password=f7tms
       </properties>
       </loader>
       </loaders>
      </jbosscache>
      
      


      and jgroups.xml file as below
      <config>
       <UDP mcast_addr="${jgroups.udp.mcast_addr:228.10.10.10}"
       mcast_port="${jgroups.udp.mcast_port:45588}" tos="8"
       ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
       mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
       loopback="false" discard_incompatible_packets="true"
       max_bundle_size="64000" max_bundle_timeout="30"
       use_incoming_packet_handler="true" ip_ttl="${jgroups.udp.ip_ttl:2}"
       enable_bundling="true" enable_diagnostics="true"
       thread_naming_pattern="cl" use_concurrent_stack="true"
       thread_pool.enabled="true" thread_pool.min_threads="2"
       thread_pool.max_threads="8" thread_pool.keep_alive_time="5000"
       thread_pool.queue_enabled="true" thread_pool.queue_max_size="1000"
       thread_pool.rejection_policy="discard"
       oob_thread_pool.enabled="true" oob_thread_pool.min_threads="1"
       oob_thread_pool.max_threads="8"
       oob_thread_pool.keep_alive_time="5000"
       oob_thread_pool.queue_enabled="false"
       oob_thread_pool.queue_max_size="100"
       oob_thread_pool.rejection_policy="Run" />
       <PING timeout="2000" num_initial_members="3" />
       <MERGE2 max_interval="30000" min_interval="10000" />
       <FD_SOCK />
       <FD timeout="10000" max_tries="5" shun="true" />
       <VERIFY_SUSPECT timeout="1500" />
       <BARRIER />
       <pbcast.NAKACK use_stats_for_retransmission="false"
       exponential_backoff="150" use_mcast_xmit="true" gc_lag="0"
       retransmit_timeout="50,300,600,1200" discard_delivered_msgs="true" />
       <UNICAST timeout="300,600,1200" />
       <pbcast.STABLE stability_delay="1000"
       desired_avg_gossip="50000" max_bytes="1000000" />
       <VIEW_SYNC avg_send_interval="60000" />
       <pbcast.GMS print_local_addr="true" join_timeout="3000"
       shun="false" view_bundling="true" />
       <FC max_credits="500000" min_threshold="0.20" />
       <FRAG2 frag_size="60000" />
       -
       <!-- pbcast.STREAMING_STATE_TRANSFER /
       -->
       <pbcast.STATE_TRANSFER />
       -
       <!-- pbcast.FLUSH /
       -->
      
       </config>
      


      My code start the cache as
      package org.gridgain.examples.jbosscache;
      
      import java.io.File;
      
      import org.jboss.cache.Cache;
      import org.jboss.cache.CacheFactory;
      import org.jboss.cache.DefaultCacheFactory;
      import org.jboss.cache.Fqn;
      import org.jboss.cache.Node;
      import org.jboss.cache.config.Configuration;
      import org.jboss.cache.config.parsing.XmlConfigurationParser;
      import org.jgroups.JChannelFactory;
      
      public final class GridJbossCacheManager {
       /** Cache configuration path relative to GridGain installation. */
       public static final String CACHE_CFG_PATH = "C:/workspace/GridJBCache3/src/config/jboss-cache.xml";
      
       /** JGroups configuration path relative to GridGain installation. */
       public static final String JGROUPS_CFG_PATH = "C:/workspace/GridJBCache3/src/config/jgroups.xml";
      
       /** JBoss Cache instance. */
       private Cache<Long, String> cache = null;
      
       /** Cache node for caching example data. */
       private Node<Long, String> cacheRoot = null;
      
       /** Singleton instance. */
       private static GridJbossCacheManager instance = new GridJbossCacheManager();
      
       /**
       * Gets singleton.
       *
       * @return Singleton.
       */
       public static GridJbossCacheManager getInstance() {
       return instance;
       }
      
       /**
       * Ensure singleton.
       */
       private GridJbossCacheManager() {
       // No-op.
       }
      
      
       public void start() throws GridException {
       File cacheCfg = new File(CACHE_CFG_PATH);
      
       if (cacheCfg == null) {
       throw new GridException("Failed to find cache configuration file: " + CACHE_CFG_PATH);
       }
      
       File jgroupsCfg = new File(JGROUPS_CFG_PATH);
      
       if (jgroupsCfg == null) {
       throw new GridException("Failed to find jgroups configuration: " + JGROUPS_CFG_PATH);
       }
      
       // Make sure JBoss Cache and GridGain are on the same "wave length".
       JChannelFactory factory = new JChannelFactory(); //null;
      
       try {
       //factory = new JChannelFactory(jgroupsCfg);
       factory.setMultiplexerConfig(jgroupsCfg.getCanonicalPath());
       }
       catch (Exception e) {
       throw new GridException("Failed to start Data Manager.", e);
       }
      
       try {
       XmlConfigurationParser parser = new XmlConfigurationParser();
      
       // Start JBoss Cache cache with shared JGroups configuration.
       Configuration svrCfg = parser.parseFile(cacheCfg.getCanonicalPath());
      
       svrCfg.getRuntimeConfig().setMuxChannelFactory(factory);
      
       CacheFactory<Long, String> dataFactory = DefaultCacheFactory.getInstance();
      
       // Instantiate and start JBoss Cache.
       cache = dataFactory.createCache(svrCfg);
      
       // Cache node for storing example data.
       cacheRoot = cache.getRoot().addChild(Fqn.fromString("/"));
       }
       catch (Exception e) {
       throw new GridException("Failed to start Data Manager.", e);
       }
      
       System.out.println("JBoss Cache data manager started.");
       }
      
      }
      


      When i ran this program i am getting the following error
      Exception in thread "main"
      Exception:
      ----------
      >>> Type: java.lang.Exception
      >>> Message: failed parsing C:\workspace\GridJBCache3\src\config\jgroups.xml
      >>> Stack trace:
      >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:216)
      >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:205)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:131)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58)
      
      Caused By:
      ----------
      >>> Type: java.io.IOException
      >>> Message: invalid XML configuration: XML protocol stack configuration does not start with a '<config>' element; maybe the XML configuration needs to be converted to the new format ?
      use 'java org.jgroups.conf.XmlConfigurator <old XML file> -new_format' to do so
      >>> Stack trace:
      >>> at org.jgroups.JChannelFactory.parse(JChannelFactory.java:476)
      >>> at org.jgroups.JChannelFactory.parse(JChannelFactory.java:462)
      >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:213)
      >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:205)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:131)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38)
      >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58)
      
      


      Now i have added the
      <protocol_stacks>
       <stack name="udp"
       description="Default: IP multicast based stack, with flow control and message bundling">
      

      to jgroups.xml. When i ran the program, its giving the following error.

      log4j:WARN No appenders could be found for logger (org.jboss.cache.util.FileLookup).
      log4j:WARN Please initialize the log4j system properly.
      Exception in thread "main" org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException
       at org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:148)
       at org.jboss.cache.factories.ComponentRegistry$PrioritizedMethod.invoke(ComponentRegistry.java:1005)
       at org.jboss.cache.factories.ComponentRegistry.internalStart(ComponentRegistry.java:775)
       at org.jboss.cache.factories.ComponentRegistry.start(ComponentRegistry.java:629)
       at org.jboss.cache.invocation.CacheInvocationDelegate.start(CacheInvocationDelegate.java:344)
       at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:121)
       at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:105)
       at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:148)
       at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38)
       at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58)
      Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:144)
       ... 9 more
      Caused by: org.jboss.cache.CacheException: Failed to create multiplexed channel using stack null
       at org.jboss.cache.RPCManagerImpl.getMultiplexerChannel(RPCManagerImpl.java:353)
       at org.jboss.cache.RPCManagerImpl.initialiseChannelAndRpcDispatcher(RPCManagerImpl.java:267)
       at org.jboss.cache.RPCManagerImpl.start(RPCManagerImpl.java:167)
       ... 14 more
      Caused by: java.lang.IllegalArgumentException: stack name and service ID have to be non null
       at org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:336)
       at org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:328)
       at org.jboss.cache.RPCManagerImpl.getMultiplexerChannel(RPCManagerImpl.java:349)
       ... 16 more
      
      



      Can any one please help me how to solve this problem.

      Thanks & Regards,
      Sridhar Reddy