0 Replies Latest reply on Nov 11, 2013 5:25 AM by K. Ayooshuo

    Using Infinispan with Scala collections: java.io.NotActiveException: Fields were never written

    K. Ayooshuo Newbie

      I have tried to use Infinispan 6.0.0. CR1 together with Scala 2.10.1 (the same error happened when I used Infinispan 5.3).
      It works when standard Java classes like String, java.util.Date are put into the cache.
      It works as well, if a Scala collection (List) is put into the default cache.
      It fails, if a Scala collection is put into a cache with persistence:
      using

          val scalaCollectionName = "scalaCollection"
          val scalaCollectionExists = cache.containsKey(scalaCollectionName)
          cache.putIfAbsent(scalaCollectionName, List.range(1, 10))
          val scalaCollectionValue =
            cache.get(scalaCollectionName).asInstanceOf[List[Int]]

      the full stack trace, and all logs before:

      11.11.2013 11:06:02 org.infinispan.factories.GlobalComponentRegistry start
      INFO: ISPN000128: Infinispan version: Infinispan 'Infinium' 6.0.0.CR1
      11.11.2013 11:06:02 org.infinispan.jmx.CacheJmxRegistration start
      INFO: ISPN000031: MBeans were successfully registered to the platform MBean server.
      11.11.2013 11:06:02 org.infinispan.marshall.core.VersionAwareMarshaller objectToBuffer
      ERROR: ISPN000065: Exception while marshalling object: List(2, 3, 4, 5, 6, 7, 8, 9)
      java.io.NotActiveException: Fields were never written
           at org.jboss.marshalling.river.RiverObjectOutputStream.finish(RiverObjectOutputStream.java:175)
           at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1009)
           at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
           at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
           at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
           at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:78)
           at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:72)
           at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
           at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
           at org.infinispan.marshall.core.MarshalledEntryImpl.marshall(MarshalledEntryImpl.java:105)
           at org.infinispan.marshall.core.MarshalledEntryImpl.getValueBytes(MarshalledEntryImpl.java:88)
           at org.infinispan.persistence.file.SingleFileStore.write(SingleFileStore.java:260)
           at org.infinispan.persistence.manager.PersistenceManagerImpl.writeToAllStores(PersistenceManagerImpl.java:432)
           at org.infinispan.interceptors.CacheWriterInterceptor.storeEntry(CacheWriterInterceptor.java:332)
           at org.infinispan.interceptors.CacheWriterInterceptor.visitPutKeyValueCommand(CacheWriterInterceptor.java:166)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:96)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.EntryWrappingInterceptor.invokeNextAndApplyChanges(EntryWrappingInterceptor.java:308)
           at org.infinispan.interceptors.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:388)
           at org.infinispan.interceptors.EntryWrappingInterceptor.visitPutKeyValueCommand(EntryWrappingInterceptor.java:157)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand(AbstractLockingInterceptor.java:47)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
           at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:32)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.CacheMgmtInterceptor.updateStoreStatistics(CacheMgmtInterceptor.java:148)
           at org.infinispan.interceptors.CacheMgmtInterceptor.visitPutKeyValueCommand(CacheMgmtInterceptor.java:134)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:106)
           at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:70)
           at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:32)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:321)
           at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1298)
           at org.infinispan.CacheImpl.putIfAbsentInternal(CacheImpl.java:895)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:886)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:1366)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:238)
           at app.webapp.scala.FileCacheServlet.doGet(FileCacheServlet.scala:55)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
           at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
           at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
           at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
           at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
           at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
           at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
           at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
           at org.mortbay.jetty.Server.handle(Server.java:322)
           at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
           at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
           at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
           at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
           at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
           at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
           at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: an exception which occurred:
           in object scala.collection.immutable.$colon$colon@9f7816e
      11.11.2013 11:06:02 org.infinispan.interceptors.InvocationContextInterceptor handleAll
      ERROR: ISPN000136: Execution error
      org.infinispan.persistence.CacheLoaderException: org.infinispan.persistence.CacheLoaderException: java.io.NotActiveException: Fields were never written
           at org.infinispan.persistence.file.SingleFileStore.write(SingleFileStore.java:297)
           at org.infinispan.persistence.manager.PersistenceManagerImpl.writeToAllStores(PersistenceManagerImpl.java:432)
           at org.infinispan.interceptors.CacheWriterInterceptor.storeEntry(CacheWriterInterceptor.java:332)
           at org.infinispan.interceptors.CacheWriterInterceptor.visitPutKeyValueCommand(CacheWriterInterceptor.java:166)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(CacheLoaderInterceptor.java:96)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.EntryWrappingInterceptor.invokeNextAndApplyChanges(EntryWrappingInterceptor.java:308)
           at org.infinispan.interceptors.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand(EntryWrappingInterceptor.java:388)
           at org.infinispan.interceptors.EntryWrappingInterceptor.visitPutKeyValueCommand(EntryWrappingInterceptor.java:157)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand(AbstractLockingInterceptor.java:47)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
           at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:32)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.CacheMgmtInterceptor.updateStoreStatistics(CacheMgmtInterceptor.java:148)
           at org.infinispan.interceptors.CacheMgmtInterceptor.visitPutKeyValueCommand(CacheMgmtInterceptor.java:134)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
           at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:106)
           at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:70)
           at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:32)
           at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:62)
           at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:321)
           at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1298)
           at org.infinispan.CacheImpl.putIfAbsentInternal(CacheImpl.java:895)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:886)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:1366)
           at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:238)
           at app.webapp.scala.FileCacheServlet.doGet(FileCacheServlet.scala:55)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
           at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
           at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
           at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
           at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
           at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
           at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
           at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
           at org.mortbay.jetty.Server.handle(Server.java:322)
           at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
           at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
           at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
           at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
           at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
           at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
           at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: org.infinispan.persistence.CacheLoaderException: java.io.NotActiveException: Fields were never written
           at org.infinispan.marshall.core.MarshalledEntryImpl.marshall(MarshalledEntryImpl.java:107)
           at org.infinispan.marshall.core.MarshalledEntryImpl.getValueBytes(MarshalledEntryImpl.java:88)
           at org.infinispan.persistence.file.SingleFileStore.write(SingleFileStore.java:260)
           ... 53 more
      Caused by: java.io.NotActiveException: Fields were never written
           at org.jboss.marshalling.river.RiverObjectOutputStream.finish(RiverObjectOutputStream.java:175)
           at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1009)
           at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
           at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
           at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
           at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectToObjectStream(AbstractJBossMarshaller.java:78)
           at org.infinispan.marshall.core.VersionAwareMarshaller.objectToBuffer(VersionAwareMarshaller.java:72)
           at org.infinispan.commons.marshall.AbstractMarshaller.objectToBuffer(AbstractMarshaller.java:41)
           at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectToBuffer(AbstractDelegatingMarshaller.java:85)
           at org.infinispan.marshall.core.MarshalledEntryImpl.marshall(MarshalledEntryImpl.java:105)
           ... 55 more
      Caused by: an exception which occurred:
           in object scala.collection.immutable.$colon$colon@9f7816e

      Config: See attachment

       

      How can I use Scala collections with a persistent cache?