HashMap persistence problem
gysz Feb 10, 2006 5:20 AMHi,
the following code generates a null pointer exception in the TreeCache class when I try to persist the treecache:
Map map = new HashMap(); map.put(MAP_KEY_PM, pm); map.put(MAP_KEY_DESTINATION, stsDestination); treeCache.put( getPathToPMIDNode(pm.getId()), // path to node map); // map;
while if I try the following:
treeCache.put( getPathToPMIDNode(pm.getId()), // path to node MAP_KEY_PM, pm); treeCache.put( getPathToPMIDNode(pm.getId()), // path to node MAP_KEY_DESTINATION, stsDestination);
it works perfectly well.
Here is the stack trace:
RuntimeMBeanException: null Cause: RuntimeMBeanException: null Cause: org.jboss.util.NestedRuntimeException: - nested throwable: (java.lang.NullPointe rException) [...] Caused by: RuntimeMBeanException: null Cause: org.jboss.util.NestedRuntimeException: - nested throwable: (java.lang.NullPointerException) at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:162) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:149) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at javax.management.MBeanServerInvocationHandler$InvokeAction.perform(MBeanServerInvocationHandler.java:322) at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:140) at $Proxy164.put(Unknown Source) at apackage.TreeCacheHandler.addMessage(TreeCacheHandler.java:267) at apackage.MasterMessageQueue.scheduleMessage(MasterMessageQueue.java:284) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) ... 46 more Caused by: org.jboss.util.NestedRuntimeException: - nested throwable: (java.lang.NullPointerException) at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:3107) at org.jboss.cache.TreeCache.put(TreeCache.java:1670) at org.jboss.cache.TreeCache.put(TreeCache.java:1654) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) ... 60 more Caused by: java.lang.NullPointerException at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:3102) ... 67 more
Here is my configuration of the environment
<attribute name="CacheLoaderClass">org.jboss.cache.loader.JDBCCacheLoader</attribute> <attribute name="CacheLoaderShared">true</attribute> <attribute name="CacheLoaderPreload">/</attribute> <attribute name="CacheLoaderFetchTransientState">true</attribute> <attribute name="CacheLoaderFetchPersistentState">false</attribute> <attribute name="CacheLoaderConfig"> cache.jdbc.table.name=mmq_schedule cache.jdbc.table.create=true cache.jdbc.table.drop=false cache.jdbc.fqn.column=fqn cache.jdbc.fqn.type=varchar(255) cache.jdbc.node.column=node cache.jdbc.node.type=longvarbinary cache.jdbc.parent.column=parent cache.jdbc.datasource=java:/DefaultDS </attribute>
where the DefaultDS is mapped to a HSQLDB database.
The JBoss version is 4.0.2 and the treecache version is:
Manifest-Version: 1.0 Specification-Title: JBoss Created-By: 1.4.2_05-b04 (Sun Microsystems Inc.) Specification-Version: 4.0.2 Implementation-Vendor-Id: http://www.jboss.org/ Implementation-URL: http://www.jboss.org/ Ant-Version: Apache Ant 1.6.2 Main-Class: org.jboss.cache.Version Implementation-Title: JBossCache Specification-Vendor: JBoss (http://www.jboss.org/) Implementation-Version: 4.0.2 (build: CVSTag=JBoss_4_0_2 date=20050502 2023) JBossCache-Version: 1.2 Implementation-Vendor: JBoss Inc.
Can anybody help me to solve this problem?
Thank you.