[jboss-user] [JBoss Cache: Core Edition] - 2.2 to 3.0CR2

lovelyliatroim do-not-reply at jboss.com
Wed Oct 29 06:57:30 EDT 2008


Hi Guys,
   Just playing with the new release and im having problems with getting the clustered cache loader to work for both config files in 2.x and 3.0 format.


Here is essential of my  config in 2.x format

  |      <attribute name="IsolationLevel">NONE</attribute>
  | 
  |      <!--
  |            Valid modes are LOCAL
  |                            REPL_ASYNC
  |                            REPL_SYNC
  |                            INVALIDATION_ASYNC
  |                            INVALIDATION_SYNC
  |       -->
  | 	  <attribute name="CacheMode">REPL_ASYNC</attribute>
  | 
  |       <!-- Name of cluster. Needs to be the same for all clusters, in order
  |            to find each other
  |       -->
  |       <attribute name="ClusterName">CMDS-Cluster</attribute>
  | 
  |       <!-- JGroups protocol stack properties NOT NEEDED since CacheMode is LOCAL -->
  | 
  |       <!--
  |           The max amount of time (in milliseconds) we wait until the
  |           state (ie. the contents of the cache) are retrieved from
  |           existing members in a clustered environment
  |       -->
  |       <attribute name="StateRetrievalTimeout">20000</attribute>
  | 
  |       <!--
  |           Number of milliseconds to wait until all responses for a
  |           synchronous call have been received.
  |       -->
  |       <attribute name="SyncReplTimeout">20000</attribute>
  | 
  |       <attribute name="FetchInMemoryState">false</attribute>
  | 
  | 	    
  | 	   
  |       <!-- Max number of milliseconds to wait for a lock acquisition -->
  |       <attribute name="LockAcquisitionTimeout">15000</attribute>
  | 				 <!--singleton_name="transport_one" -->
  | 
  | 	   <attribute name="ClusterConfig">
  |          <config>
  |             <UDP mcast_addr="228.10.10.10"
  |                  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="2"
  |                  enable_bundling="false"
  |                  enable_diagnostics="true"
  | 
  |                  use_concurrent_stack="true"
  | 
  |                  thread_naming_pattern="pl"
  | 
  |                  thread_pool.enabled="true"
  |                  thread_pool.min_threads="1"
  |                  thread_pool.max_threads="25"
  |                  thread_pool.keep_alive_time="30000"
  |                  thread_pool.queue_enabled="true"
  |                  thread_pool.queue_max_size="10"
  |                  thread_pool.rejection_policy="Run"
  | 
  |                  oob_thread_pool.enabled="true"
  |                  oob_thread_pool.min_threads="1"
  |                  oob_thread_pool.max_threads="4"
  |                  oob_thread_pool.keep_alive_time="10000"
  |                  oob_thread_pool.queue_enabled="true"
  |                  oob_thread_pool.queue_max_size="10"
  |                  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"/>
  |             <pbcast.NAKACK 
  |                            use_mcast_xmit="false" gc_lag="0"
  |                            retransmit_timeout="300,600,1200,2400,4800"
  |                            discard_delivered_msgs="true"/>
  |             <UNICAST timeout="300,600,1200,2400,3600"/>
  |             <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
  |                            max_bytes="400000"/>
  |             <pbcast.GMS print_local_addr="true" join_timeout="5000"
  |                         shun="false"
  |                         view_bundling="true" view_ack_collection_timeout="5000"/>
  |             <FRAG2 frag_size="60000"/>
  |             <pbcast.STREAMING_STATE_TRANSFER />
  |             <!-- <pbcast.STATE_TRANSFER/> -->
  |             <pbcast.FLUSH timeout="0"/>
  | 			
  |          </config>
  |       
  | </attribute>
  | <attribute name="CacheLoaderConfig" replace="false">
  |          <config>
  | 			 <cacheloader>
  | 				<class>org.jboss.cache.loader.ClusteredCacheLoader</class>
  | 					<properties>
  | 						timeout=15000
  | 					</properties>
  | 			</cacheloader>
  | 		
  | 			 
  |          </config>
  | 	</attribute>
  | 


Here is my test case

 




  | public void testClusteredLoader(String configPath){
  | 		
  | 		CacheFactory factory = DefaultCacheFactory.getInstance();
  |         Cache cache = factory.createCache(configPath);
  |         CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(cache);
  |         wrapper.create();
  |         wrapper.start();
  | 
  |         Cache cache2 = factory.createCache(configPath);
  |         CacheJmxWrapperMBean wrapper2 = new CacheJmxWrapper(cache2);
  |         wrapper2.create();
  |         wrapper2.start();
  |         
  |         HashMap testData = new HashMap();
  |         testData.put("CLIENT", "BOND,JAMES");
  |         Fqn path = Fqn.fromString("/client/007");
  |         String key ="agent";
  |         cache.put(path,key ,testData);
  |         HashMap data = (HashMap)cache.get(path, key);
  |         if(data != null ){
  |         	System.out.println("Got data from cache "+data.toString());
  |         }else{
  |         	System.out.println("Failed to get data from the cache???");
  |         }
  |         
  |     	System.out.println("Lets test ClusteredCacheLoader");
  |         HashMap data2 = (HashMap)cache2.get(path, key);
  |         if(data2 != null ){
  |         	System.out.println("Got data from remote cache "+data.toString());
  |         }else{
  |         	System.out.println("Failed to get data from remote cache???");
  |         }
  |         
  |    		cache.stop();
  |         cache.destroy();
  |    		cache2.stop();
  |         cache2.destroy();
  | 		
  | 	}
  | 
  | 

When i run the test case with config file in 2.x format this is what i see



  | 
  | -------------------------------------------------------
  | GMS: address is 10.251.153.36:1598
  | -------------------------------------------------------
  | 
  | -------------------------------------------------------
  | GMS: address is 10.251.153.36:1602
  | -------------------------------------------------------
  | Got data from cache {CLIENT=BOND,JAMES}
  | Lets test ClusteredCacheLoader
  | org.jboss.cache.lock.TimeoutException: Unable to acquire lock on Fqn [/client/007] after [15000] milliseconds for requestor [Thread[main,5,main]]! Lock held by [null]
  | 	at org.jboss.cache.mvcc.MVCCNodeHelper.acquireLock(MVCCNodeHelper.java:170)
  | 	at org.jboss.cache.mvcc.MVCCNodeHelper.wrapNodeForWriting(MVCCNodeHelper.java:259)
  | 	at org.jboss.cache.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:282)
  | 	at org.jboss.cache.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:158)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:131)
  | 	at org.jboss.cache.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:110)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:131)
  | 	at org.jboss.cache.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:110)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
  | 	at org.jboss.cache.interceptors.TxInterceptor.attachGtxAndPassUpChain(TxInterceptor.java:284)
  | 	at org.jboss.cache.interceptors.TxInterceptor.handleDefault(TxInterceptor.java:271)
  | 	at org.jboss.cache.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:110)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
  | 	at org.jboss.cache.interceptors.CacheMgmtInterceptor.visitGetKeyValueCommand(CacheMgmtInterceptor.java:77)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)
  | 	at org.jboss.cache.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:178)
  | 	at org.jboss.cache.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:130)
  | 	at org.jboss.cache.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:110)
  | 	at org.jboss.cache.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:97)
  | 	at org.jboss.cache.interceptors.InterceptorChain.invoke(InterceptorChain.java:265)
  | 	at org.jboss.cache.invocation.CacheInvocationDelegate.get(CacheInvocationDelegate.java:448)
  | 	at at.sit.cmds.cache.test.CacheTestClient.testClusteredLoader(CacheTestClient.java:259)
  | 	at at.sit.cmds.cache.test.CacheTestClient.main(CacheTestClient.java:341)
  | 

When I run with 3.0.X version(File is generated using the script from 2.x to 3.0 provided with 3.x download) , i get this as follows,  


  | 
  | java.lang.NullPointerException
  | 	at org.jboss.cache.config.parsing.XmlConfigurationParser2x.getMBeanElement(XmlConfigurationParser2x.java:207)
  | 	at org.jboss.cache.config.parsing.XmlConfigurationParser2x.parseStream(XmlConfigurationParser2x.java:104)
  | 	at org.jboss.cache.config.parsing.XmlConfigurationParser2x.parseFile(XmlConfigurationParser2x.java:90)
  | 	at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:90)
  | 	at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:76)
  | 	at at.sit.cmds.cache.test.CacheTestClient.testClusteredLoader(CacheTestClient.java:236)
  | 	at at.sit.cmds.cache.test.CacheTestClient.main(CacheTestClient.java:340)
  | 

Now this last problem looks like it using the 2.x formatter to parse the config file, which kind of suggests to me that either my classpath is not right and contains 2.x version in there or something is not right in the jar file. I will set up the test through a script and set only the needed libraries and report back but my project classpath looks fine and with the test run in 2.x config file format it looks like the 3.0.x jar is been used so that concludes something wrong in the jar. As i said will test it with a script to be sure that im using correct jar file ;).

Any thoughts on why it doesnt work would be great.

Thanks,
LL 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185335#4185335

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185335



More information about the jboss-user mailing list