2 Replies Latest reply on Aug 26, 2014 2:33 AM by Lowry Cui

    Read cache content from database issue

    Lowry Cui Newbie

      Hi All,

      I deployed Modeshape3.8+infinispan5.3  in jboss EAP 6.3. 
      I can store cache contents into database, but couldn't read it from another java application.

      The follow is stack trace.

      Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.jboss.marshalling.Externalizer

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:999)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1243)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213)

        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45)

        at org.infinispan.container.entries.ImmortalCacheValue$Externalizer.readObject(ImmortalCacheValue.java:140)

        at org.infinispan.container.entries.ImmortalCacheValue$Externalizer.readObject(ImmortalCacheValue.java:132)

        at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)

        at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)

        at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:167)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:355)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213)

        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45)

        at org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:163)

        at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:121)

        at org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:128)

        at org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromInputStream(AbstractDelegatingMarshaller.java:84)

        at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:88)

        at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.readStoredEntry(JdbcStringBasedCacheStore.java:412)

        at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.loadLockSafe(JdbcStringBasedCacheStore.java:343)

        at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.loadLockSafe(JdbcStringBasedCacheStore.java:87)

        at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:142)

        at org.infinispan.loaders.jdbc.mixed.JdbcMixedCacheStore.load(JdbcMixedCacheStore.java:135)

        at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:186)

        at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeededAndUpdateStats(CacheLoaderInterceptor.java:252)

        at org.infinispan.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:119)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)

        at org.infinispan.interceptors.EntryWrappingInterceptor.visitGetKeyValueCommand(EntryWrappingInterceptor.java:131)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)

        at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)

        at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)

        at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.visitGetKeyValueCommand(AbstractTxLockingInterceptor.java:91)

        at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitGetKeyValueCommand(OptimisticLockingInterceptor.java:151)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)

        at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)

        at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)

        at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:231)

        at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:226)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)

        at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:128)

        at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:92)

        at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:104)

        at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:58)

        at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:343)

        at org.infinispan.CacheImpl.get(CacheImpl.java:289)

        at org.infinispan.CacheImpl.get(CacheImpl.java:281)

        at org.infinispan.schematic.internal.CacheSchematicDb.get(CacheSchematicDb.java:235)

        at org.modeshape.jcr.cache.document.LocalDocumentStore.get(LocalDocumentStore.java:78)

        at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:164)

        at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1107)

        at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:971)

        at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:404)

        at org.modeshape.jcr.JcrRepository.start(JcrRepository.java:328)

        at org.modeshape.jcr.JcrRepositoriesContainer$UrlRepositoryLookup.repository(JcrRepositoriesContainer.java:220)

        ... 5 more

       

      Is there someone can help me?. thanks

        • 1. Re: Read cache content from database issue
          Wolf-Dieter Fink Master

          Regarding the exception how do you get/put the entries, could you show examples?

           

          If you use EAP6 (in production ) with a subscription you need to have JDG to be supported.

          • 2. Re: Re: Read cache content from database issue
            Lowry Cui Newbie

            @Wolf-Dieter Fink  Thanks for your reply. What's the JDG ?

            I used EAP6.3 alpha version.

            I can upload a jar(which contains xml, properties and jbpm files) to Modeshape engine.
            Infinispan is modeshape's cache store, will store contents to database.

             

            Then I wrote following method to read content from database, but throw above exception when initialize repository

             

             

                      public static void main(String[] args) {

                            Properties props = new Properties();

                            props.put(JcrRepository.MODE_SHAPE_CONFIG_URL, "classpath:modeshape-repository-config.json");

                            Repository repository = new JcrRepository(props);               

             

                           assert repository != null;

                            Resource resources = repository.listFirstResource("jcr:routes.xml");

             

                           assert resources != null;

                      }

             

             

            The attached standalone.xml is my configuration with JBOSS EAP 6.3.

            Both modehspae-repository-config.json and infinispan-config.xml are used in java application.