[jboss-user] [JBoss Cache: Core Edition] - jdbc cacheloader configuration prgramatically

sridhar_ratna do-not-reply at jboss.com
Wed May 6 06:30:00 EDT 2009


i am trying to configure jdbc cache loader dynamically.
but its giving ConfigurationException

public class CacheLoaderUtil {
  | 	public static Node<String, Object> getCacheNode(int dataNodeNo) {
  | 		Cache<String, Object> cache = createCacheFactory(dataNodeNo);
  | 		cache.create();
  | 		cache.start();
  | 		return cache.getRoot();
  | 	}
  | 
  | 	private static Cache<String, Object> createCacheFactory() {
  | 
  | 
  | 		Configuration config = new Configuration();
  | 		config
  | 				.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class
  | 						.getName());
  | 		config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
  | 		config.setCacheMode(CacheMode.LOCAL);
  | 		config.setLockAcquisitionTimeout(15000);
  | 
  | 		EvictionConfig ec = new EvictionConfig();
  | 		ec.setWakeupInterval(5);
  | 
  | 		EvictionRegionConfig erc = new EvictionRegionConfig();
  | 		erc.setRegionName("/");
  | 		erc.setEventQueueSize(2000);
  | 		erc.setEvictionAlgorithmConfig(new LRUAlgorithmConfig(300, 300, 500));
  | 
  | 		List<EvictionRegionConfig> ercs = new ArrayList<EvictionRegionConfig>();
  | 		ercs.add(erc);
  | 		ec.setEvictionRegionConfigs(ercs);
  | 
  | 		config.setEvictionConfig(ec);
  | 
  | 		CacheLoaderConfig loaderConfig = new CacheLoaderConfig();
  | 		loaderConfig.setPassivation(false);
  | 		loaderConfig.setShared(false);
  | 		loaderConfig.setPreload("/");
  | 
  | 		JDBCCacheLoaderConfig jdbcConfig = new JDBCCacheLoaderConfig();
  | 		jdbcConfig.setAsync(false);
  | 		jdbcConfig.setCreateTable(true);
  | 		jdbcConfig.setDriverClass(props.getProperty("Driver.Class"));
  | 		jdbcConfig.setDropTable(false);
  | 		jdbcConfig.setFetchPersistentState(true);
  | 		jdbcConfig.setIgnoreModifications(false);
  | 		jdbcConfig.setPurgeOnStartup(false);
  | 		jdbcConfig.setTable("jbosscache");
  | 		jdbcConfig.setPrimaryKey("jbosscache_pk");
  | 		jdbcConfig.setFqnColumn("fqn");
  | 		jdbcConfig.setFqnType("VARCHAR(255)");
  | 		jdbcConfig.setNodeColumn("value");
  | 		jdbcConfig.setNodeType(props.getProperty("Value.Type"));
  | 		jdbcConfig.setParentColumn("parent");
  | 		jdbcConfig.setJdbcURL(props.getProperty("Jdbc.URL"));
  | 		jdbcConfig.setJdbcUser(props.getProperty("Jdbc.User"));
  | 		jdbcConfig.setJdbcPassword(props.getProperty("Jdbc.Password"));
  | 		
  | 		
  | 		loaderConfig.addIndividualCacheLoaderConfig(jdbcConfig);
  | 
  | 		config.setCacheLoaderConfig(loaderConfig);
  | 		
  | 		CacheFactory<String, Object> factory = new DefaultCacheFactory<String, Object>();
  | 		
  | 		Cache<String, Object> cache = factory.createCache(config);
  | 		return cache;
  | 	}
  | 
  | 	
  | 	public static void main(String[] args) {
  | 		CacheLoaderUtil.getCacheNode();
  | 	}
  | }
  | 



stack trace is

Exception in thread "main" org.jboss.cache.config.ConfigurationException: Unable to build interceptor chain
  | 	at org.jboss.cache.factories.InterceptorChainFactory.construct(InterceptorChainFactory.java:229)
  | 	at org.jboss.cache.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:315)
  | 	at org.jboss.cache.factories.ComponentRegistry.invokeInjectionMethod(ComponentRegistry.java:276)
  | 	at org.jboss.cache.factories.ComponentRegistry$Component.injectDependencies(ComponentRegistry.java:
  | 974)
  | 	at org.jboss.cache.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:252)
  | 	at org.jboss.cache.DefaultCacheFactory.bootstrap(DefaultCacheFactory.java:155)
  | 	at org.jboss.cache.DefaultCacheFactory.createAndWire(DefaultCacheFactory.java:141)
  | 	at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:120)
  | 	at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:105)
  | 	at com.cmc.facts.util.CacheLoaderUtil.createCacheFactory(CacheLoaderUtil.java:126)
  | 	at com.cmc.facts.util.CacheLoaderUtil.getCacheNode(CacheLoaderUtil.java:42)
  | 	at com.cmc.facts.util.CacheLoaderUtil.main(CacheLoaderUtil.java:132)
  | Caused by: org.jboss.cache.config.ConfigurationException: Unable to build interceptor chain
  | 	at org.jboss.cache.factories.InterceptorChainFactory.construct(InterceptorChainFactory.java:229)
  | 	at org.jboss.cache.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:315)
  | 	at org.jboss.cache.factories.ComponentRegistry.invokeInjectionMethod(ComponentRegistry.java:276)
  | 	at org.jboss.cache.factories.ComponentRegistry$Component.injectDependencies(ComponentRegistry.java:
  | 974)
  | 

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

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



More information about the jboss-user mailing list