Hi,

I am trying to configure cache with JDBC Cacheloader programatically.

Populated the configuration Object with each element that i specified in xml 
configuration. When I run program its giving an error "Exception in thread 
"main" org.jboss.cache.config.ConfigurationException: Unable to build 
interceptor chain"
But the same is running fine when run with xml configuration.

Can any body please help me in solving this problem.

JBoss Cache version : 3.02

code : CacheLoaderUtil

  | import java.util.ArrayList;
  | import java.util.List;
  | import org.jboss.cache.Cache;
  | import org.jboss.cache.CacheFactory;
  | import org.jboss.cache.DefaultCacheFactory;
  | import org.jboss.cache.Node;
  | import org.jboss.cache.config.CacheLoaderConfig;
  | import org.jboss.cache.config.Configuration;
  | import org.jboss.cache.config.EvictionConfig;
  | import org.jboss.cache.config.EvictionRegionConfig;
  | import 
org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
  | import org.jboss.cache.config.Configuration.CacheMode;
  | import org.jboss.cache.eviction.LRUAlgorithmConfig;
  | import org.jboss.cache.loader.JDBCCacheLoaderConfig;
  | import org.jboss.cache.lock.IsolationLevel;
  | import org.jboss.cache.transaction.GenericTransactionManagerLookup;
  | 
  | 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"));
  |             
  |             
  |             SingletonStoreConfig ssc = new SingletonStoreConfig();
  |             ssc.setSingletonStoreEnabled(false);
  |             jdbcConfig.setSingletonStoreConfig(ssc);
  |             
  |             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)
  |     at 
org.jboss.cache.factories.ComponentRegistry.registerComponent(ComponentRegistry.java:252)
  |     at 
org.jboss.cache.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.InterceptorChainFactory.createInterceptor(InterceptorChainFactory.java:60)
  |     at 
org.jboss.cache.factories.InterceptorChainFactory.buildInterceptorChain(InterceptorChainFactory.java:75)
  |     at 
org.jboss.cache.factories.InterceptorChainFactory.construct(InterceptorChainFactory.java:225)
  |     ... 11 more
  | Caused by: 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.invokeInjectionMethod(ComponentRegistry.java:279)
  |     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.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:322)
  |     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.factories.InterceptorChainFactory.createInterceptor(InterceptorChainFactory.java:60)
  |     at 
org.jboss.cache.factories.InterceptorChainFactory.buildInterceptorChain(InterceptorChainFactory.java:121)
  |     at 
org.jboss.cache.factories.InterceptorChainFactory.construct(InterceptorChainFactory.java:225)
  |     ... 54 more
  | Caused by: java.lang.reflect.InvocationTargetException
  |     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  |     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  |     at java.lang.reflect.Method.invoke(Unknown Source)
  |     at 
org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:144)
  |     ... 64 more
  | Caused by: org.jboss.cache.CacheException: Unable to create cache loaders
  |     at 
org.jboss.cache.loader.CacheLoaderManager.injectDependencies(CacheLoaderManager.java:110)
  |     ... 69 more
  | Caused by: java.lang.IllegalStateException: Connection factory class could 
not be loaded
  |     at 
org.jboss.cache.loader.AdjListJDBCCacheLoader.setConfig(AdjListJDBCCacheLoader.java:141)
  |     at 
org.jboss.cache.loader.CacheLoaderManager.createCacheLoader(CacheLoaderManager.java:269)
  |     at 
org.jboss.cache.loader.CacheLoaderManager.createCacheLoader(CacheLoaderManager.java:195)
  |     at 
org.jboss.cache.loader.CacheLoaderManager.injectDependencies(CacheLoaderManager.java:106)
  |     ... 69 more
  | Caused by: java.lang.NullPointerException
  |     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  |     at java.lang.ClassLoader.loadClass(Unknown Source)
  |     at org.jboss.cache.util.Util.loadClass(Util.java:53)
  |     at 
org.jboss.cache.loader.AdjListJDBCCacheLoader.setConfig(AdjListJDBCCacheLoader.java:136)
  |     ... 72 more


working xml config file is 
<?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">
  | 
  |     <transaction
  |             
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"
 />
  | 
  |     <eviction wakeUpInterval="5000">
  |             <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
  |                     eventQueueSize="200000">
  |                     <property name="maxNodes" value="5000" />
  |                     <property name="timeToLive" value="3000" />
  |             </default>
  |             <region name="/">
  |                     <property name="maxNodes" value="100" />
  |                     <property name="timeToLive" value="0" />
  |             </region>
  |     </eviction>
  |     
  |     <jmxStatistics enabled="true"/>
  |     <loaders passivation="false" shared="false">
  |             <preload>
  |                     <node fqn="/" />
  |             </preload>
  |             <loader class="org.jboss.cache.loader.JDBCCacheLoader"
  |                     async="false" fetchPersistentState="true" 
ignoreModifications="false"
  |                     purgeOnStartup="false">
  |                     <properties>
  |                             cache.jdbc.table.name=jbosscache
  |                             cache.jdbc.table.create=false
  |                             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=value
  |                             cache.jdbc.node.type=bytea
  |                             cache.jdbc.parent.column=parent
  |                             
cache.jdbc.driver=oracle.jdbc.driver.OracleDriver
  |                             
cache.jdbc.url=jdbc:oracle:thin:@172.16.16.160:1521:facts
  |                             cache.jdbc.user=jbcache
  |                             cache.jdbc.password=jbcache
  |                     </properties>
  |             </loader>
  |     </loaders>
  | </jbosscache>


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

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4228265
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to