Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1332

tree cache cannot be enabled for persistence due to serialization issue (java.io.NotSerializableException: org.infinispan.tree.NodeKey)

    XMLWordPrintable

Details

    • Hide

      TC xml: treecache.xml:

      <?xml version="1.0" encoding="UTF-8"?>

      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:infinispan:config:5.0 http://www.infinispan.org/schemas/infinispan-config-5.0.xsd"
      xmlns="urn:infinispan:config:5.0">

      <default>
      <invocationBatching enabled="true" />
      <!--
      <indexing enabled="true" indexLocalOnly="true">
      <properties>
      <property name="hibernate.search.default.directory_provider" value="ram" />
      </properties>
      </indexing>
      -->

      <loaders passivation="false">
      <loader class="org.infinispan.loaders.jdbm.JdbmCacheStore" fetchPersistentState="false"
      ignoreModifications="false" purgeOnStartup="false">
      <properties>
      <property name="location" value="/tmp/ifspntest/"/>
      </properties>
      <async enabled="false"/>
      </loader>
      </loaders>

      </default>

      </infinispan>

      UT:

      import org.infinispan.Cache;
      import org.infinispan.manager.DefaultCacheManager;
      import org.infinispan.manager.EmbeddedCacheManager;
      import org.infinispan.tree.TreeCache;
      import org.infinispan.tree.TreeCacheFactory;
      import org.testng.annotations.BeforeMethod;
      import org.testng.annotations.Test;

      import static org.testng.Assert.assertEquals;

      @Test
      public class PersistentTreeCacheTest {

      TreeCache treeCache;

      @BeforeMethod
      public void init() throws Exception

      { EmbeddedCacheManager manager = new DefaultCacheManager("treecache.xml", true); Cache c = manager.getCache("simple"); TreeCacheFactory tf = new TreeCacheFactory(); treeCache = tf.createTreeCache(c); System.out.println("treeCache = " + treeCache); treeCache.start(); }

      @Test
      public void testPut()

      { treeCache.getRoot().put("key1", "data1"); assertEquals("data1", treeCache.getRoot().get("key1")); }

      }

      Show
      TC xml: treecache.xml: <?xml version="1.0" encoding="UTF-8"?> <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.0 http://www.infinispan.org/schemas/infinispan-config-5.0.xsd " xmlns="urn:infinispan:config:5.0"> <default> <invocationBatching enabled="true" /> <!-- <indexing enabled="true" indexLocalOnly="true"> <properties> <property name="hibernate.search.default.directory_provider" value="ram" /> </properties> </indexing> --> <loaders passivation="false"> <loader class="org.infinispan.loaders.jdbm.JdbmCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false"> <properties> <property name="location" value="/tmp/ifspntest/"/> </properties> <async enabled="false"/> </loader> </loaders> </default> </infinispan> UT: import org.infinispan.Cache; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.EmbeddedCacheManager; import org.infinispan.tree.TreeCache; import org.infinispan.tree.TreeCacheFactory; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; @Test public class PersistentTreeCacheTest { TreeCache treeCache; @BeforeMethod public void init() throws Exception { EmbeddedCacheManager manager = new DefaultCacheManager("treecache.xml", true); Cache c = manager.getCache("simple"); TreeCacheFactory tf = new TreeCacheFactory(); treeCache = tf.createTreeCache(c); System.out.println("treeCache = " + treeCache); treeCache.start(); } @Test public void testPut() { treeCache.getRoot().put("key1", "data1"); assertEquals("data1", treeCache.getRoot().get("key1")); } }
    • Low

    Description

      If enabled persistence in treecache - using treecache leads to serialization issue:

      ERROR:

      org.infinispan.CacheException: Unable to invoke method public void org.infinispan.eviction.PassivationManagerImpl.passivateAll() throws org.infinispan.loaders.CacheLoaderException on object
      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:173)
      at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:890)
      at org.infinispan.factories.AbstractComponentRegistry.internalStop(AbstractComponentRegistry.java:716)
      at org.infinispan.factories.AbstractComponentRegistry.stop(AbstractComponentRegistry.java:603)
      at org.infinispan.factories.ComponentRegistry.stop(ComponentRegistry.java:205)
      at org.infinispan.CacheImpl.stop(CacheImpl.java:378)
      at org.infinispan.manager.DefaultCacheManager.stop(DefaultCacheManager.java:599)
      at eu.ysoft.cache.replicator.IfspnReplicationBuffer.stop(IfspnReplicationBuffer.java:178)
      at eu.ysoft.cache.replicator.IfspnReplicationBufferTestsBase.destroy(IfspnReplicationBufferTestsBase.java:51)
      at eu.ysoft.cache.replicator.IfspnReplicationBufferTests.destroy(IfspnReplicationBufferTests.java:35)
      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:597)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:753)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.runWorkers(TestRunner.java:1178)
      at org.testng.TestRunner.privateRun(TestRunner.java:757)
      at org.testng.TestRunner.run(TestRunner.java:608)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)
      at org.testng.TestNG.run(TestNG.java:999)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
      at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:106)
      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:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.lang.reflect.InvocationTargetException
      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:597)
      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:170)
      ... 42 more
      Caused by: org.infinispan.loaders.CacheLoaderException: java.io.NotSerializableException: org.infinispan.tree.NodeKey
      at org.infinispan.loaders.jdbm.JdbmCacheStore.store0(JdbmCacheStore.java:317)
      at org.infinispan.loaders.jdbm.JdbmCacheStore.store(JdbmCacheStore.java:292)
      at org.infinispan.eviction.PassivationManagerImpl.passivateAll(PassivationManagerImpl.java:108)
      ... 47 more
      Caused by: java.io.NotSerializableException: org.infinispan.tree.NodeKey
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      at jdbm.htree.HashBucket.writeExternal(HashBucket.java:270)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1429)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1398)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
      at jdbm.helper.Serialization.serialize(Serialization.java:75)
      at jdbm.helper.DefaultSerializer.serialize(DefaultSerializer.java:82)
      at jdbm.recman.BaseRecordManager.insert(BaseRecordManager.java:202)
      at jdbm.recman.CacheRecordManager.insert(CacheRecordManager.java:156)
      at jdbm.recman.CacheRecordManager.insert(CacheRecordManager.java:140)
      at jdbm.htree.HashDirectory.put(HashDirectory.java:233)
      at jdbm.htree.HTree.put(HTree.java:129)
      at org.infinispan.loaders.jdbm.JdbmCacheStore.store0(JdbmCacheStore.java:313)
      ... 49 more

      Attachments

        Activity

          People

            gzamarre Galder ZamarreƱo
            jsl_jira Jan Slezak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: