nullpointerexception
majecek Feb 8, 2005 4:47 AMhi
I got this exception when I am trying to initialize TreeCache actualy mbean.
I am using JbossCache 1.2 and Hibernate 2.1.6. Everything works fine if I am using EhCache, immediately when I switch to JbossCache I got the error.
Can you help me to solve the problem? Here are my conf. files:
hibernate.properties
hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver hibernate.connection.url=jdbc:oracle:thin:@oracle:1521:test hibernate.connection.username=user hibernate.connection.password=pass #hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider hibernate.cache.provider_class=net.sf.hibernate.cache.TreeCacheProvider #hibernate.show_sql=true #hibernate.transaction.manager_lookup_class =net.sf.hibernate.transaction.JBossTransactionManagerLookup
mapping file:
<?xml ....> <!DOCTYPE ...> <hibernate-mapping package="hibernate.data"> <class name="WaLanguages" table="WA_LANGUAGES"> <cache usage="read-only"/> <id name="id" column="ID" type="java.lang.Long"> <generator class="increment"/> </id> <property name="name" column="NAME" type="java.lang.String" not-null="true" /> </class> </hibernate-mapping>
treechache.xml
<?xml version="1.0" encoding="UTF-8"?> <server> <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/> <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache"> <depends>jboss:service=Naming</depends> <depends>jboss:service=TransactionManager</depends> <!-- <attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>--> <attribute name="IsolationLevel">REPEATABLE_READ</attribute> <attribute name="ClusterName">TreeCache-Cluster</attribute> <attribute name="CacheMode">REPL_SYNC</attribute> <attribute name="SyncReplTimeout">10000</attribute> <attribute name="LockAcquisitionTimeout">15000</attribute> <attribute name="FetchStateOnStartup">true</attribute> <attribute name="EvictionPolicyClass"> org.jboss.cache.eviction.LRUPolicy </attribute> <attribute name="EvictionPolicyConfig"> <config> <attribute name="wakeUpIntervalSeconds">5</attribute> </config> </attribute> <attribute name="ClusterConfig"> <config> <UDP mcast_addr="10.15.2.16" mcast_port="45566" 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" bind_addr="127.0.0.1"/> <PING timeout="2000" num_initial_members="3" up_thread="false" down_thread="false"/> <MERGE2 min_interval="10000" max_interval="20000"/> <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"/> </config> </attribute> </mbean> </server>
output of log:
2005-02-08 10:28:42,092 [main] DEBUG org.jboss.cache.PropertyConfigurator - setting attribute EvictionPolicyClass to org.jboss.cache.eviction.LRUPolicy 2005-02-08 10:28:56,155 [main] ERROR org.jboss.cache.TreeCache - setEvictionPolicyClass(): failed creating instance of org.jboss.cache.eviction.LRUPolicy java.lang.NullPointerException at org.jboss.cache.TreeCache.setEvictionPolicyClass(TreeCache.java:899) 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:324) at org.jboss.cache.PropertyConfigurator.configure(PropertyConfigurator.java:218) at org.jboss.cache.PropertyConfigurator.configure(PropertyConfigurator.java:162) at net.sf.hibernate.cache.TreeCache.<init>(TreeCache.java:42) at net.sf.hibernate.cache.TreeCacheProvider.buildCache(TreeCacheProvider.java:14) at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1130) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:790) at com.tietoenator.webAd.server.persistency.hibernate.AbstractHibernateConfig.<clinit>(AbstractHibernateConfig.java:135) 2005-02-08 10:29:26,186 [main] DEBUG org.jboss.cache.PropertyConfigurator - Invoking setter method: public void org.jboss.cache.TreeCache.setEvictionPolicyConfig(org.w3c.dom.Element) with parameter "[config: null]" of type class org.apache.xerces.dom.DeferredElementImpl 2005-02-08 10:29:32,733 [main] INFO org.jboss.cache.TreeCache - setEvictionPolicyConfig(): [config: null] 2005-02-08 10:29:38,686 [main] DEBUG org.jboss.cache.PropertyConfigurator - Invoking setter method: public void org.jboss.cache.TreeCache.setClusterConfig(org.w3c.dom.Element) with parameter "[config: null]" of type class org.apache.xerces.dom.DeferredElementImpl 2005-02-08 10:29:39,811 [main] INFO org.jboss.cache.TreeCache - setting cluster properties from xml to: UDP(bind_addr=127.0.0.1;ip_mcast=true;ip_ttl=64;loopback=true;mcast_addr=10.15.2.16;mcast_port=45566;mcast_recv_buf_size=80000;mcast_send_buf_size=150000;ucast_recv_buf_size=80000;ucast_send_buf_size=150000):PING(down_thread=false;num_initial_members=3;timeout=2000;up_thread=false):MERGE2(max_interval=20000;min_interval=10000):FD_SOCK:VERIFY_SUSPECT(down_thread=false;timeout=1500;up_thread=false):pbcast.NAKACK(down_thread=false;gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800;up_thread=false):UNICAST(down_thread=false;min_threshold=10;timeout=600,1200,2400;window_size=100):pbcast.STABLE(desired_avg_gossip=20000;down_thread=false;up_thread=false):FRAG(down_thread=false;frag_size=8192;up_thread=false):pbcast.GMS(join_retry_timeout=2000;join_timeout=5000;print_local_addr=true;shun=true):pbcast.STATE_TRANSFER(down_thread=true;up_thread=true) 2005-02-08 10:29:39,811 [main] INFO net.sf.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 2005-02-08 10:37:27,361 [main] DEBUG org.jboss.cache.TreeCache - Starting TreeCache 2005-02-08 10:37:53,924 [main] WARN org.jboss.cache.TreeCache - No transaction manager lookup class has been defined. Transactions cannot be used 2005-02-08 10:38:23,362 [main] ERROR org.jboss.cache.TreeCache - Starting failed TreeCache java.lang.NullPointerException at org.jboss.cache.TreeCache.createInterceptor(TreeCache.java:1258) at org.jboss.cache.TreeCache.createInterceptorChain(TreeCache.java:1148) at org.jboss.cache.TreeCache.startService(TreeCache.java:1057) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271) at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:172) at net.sf.hibernate.cache.TreeCache.<init>(TreeCache.java:47) at net.sf.hibernate.cache.TreeCacheProvider.buildCache(TreeCacheProvider.java:14) at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1130) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:790) at com.tietoenator.webAd.server.persistency.hibernate.AbstractHibernateConfig.<clinit>(AbstractHibernateConfig.java:135)