7 Replies Latest reply on Jan 11, 2017 9:36 AM by Simon Prinz

    StreamCorruptedException: Unexpected byte found when reading an object

    Simon Prinz Newbie

      Hi,

       

      we ran into the following problem:

       

      Our application server (karaf) had memory problems and had to be restartet. After that our users got a system error after logging into our application. After some research we found out, that the reason is a currupt object. We can not delete the object / file itself or its parent folder.

       

      If we try to access/delete/move the file, we get the following error/stacktrace:

       

      2016-12-14 15:09:52,739 | ERROR | tp1356847008-675 | CmisAtomPubServlet         | 35 - de.company.quala.components.cmis.web - 1.4.13 | java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50

      org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50

          at org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper.createCmisException(ConformanceCmisServiceWrapper.java:177)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper.getDescendants(ConformanceCmisServiceWrapper.java:653)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.impl.atompub.NavigationService$GetDescendants.serve(NavigationService.java:224)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.shared.Dispatcher.dispatch(Dispatcher.java:92)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.dispatch(CmisAtomPubServlet.java:234)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet.service(CmisAtomPubServlet.java:181)[35:de.company.quala.components.cmis.web:1.4.13]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)[145:javax.servlet-api:3.1.0]

          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[241:org.eclipse.jetty.servlet:9.2.15.v20160210]

          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[241:org.eclipse.jetty.servlet:9.2.15.v20160210]

          at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[267:org.ops4j.pax.web.pax-web-jetty:4.2.6]

          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[239:org.eclipse.jetty.security:9.2.15.v20160210]

          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:276)[267:org.ops4j.pax.web.pax-web-jetty:4.2.6]

          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[241:org.eclipse.jetty.servlet:9.2.15.v20160210]

          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[267:org.ops4j.pax.web.pax-web-jetty:4.2.6]

          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.Server.handle(Server.java:499)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[240:org.eclipse.jetty.server:9.2.15.v20160210]

          at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[232:org.eclipse.jetty.io:9.2.15.v20160210]

          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[243:org.eclipse.jetty.util:9.2.15.v20160210]

          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[243:org.eclipse.jetty.util:9.2.15.v20160210]

          at java.lang.Thread.run(Thread.java:745)[:1.8.0_102]

      Caused by: org.infinispan.persistence.spi.PersistenceException: java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50

          at org.infinispan.marshall.core.MarshalledEntryImpl.unmarshall(MarshalledEntryImpl.java:116)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.marshall.core.MarshalledEntryImpl.getValue(MarshalledEntryImpl.java:61)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.persistence.PersistenceUtil.convert(PersistenceUtil.java:136)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.persistence.PersistenceUtil$4.compute(PersistenceUtil.java:106)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurrentExtendedMap$2.apply(DefaultDataContainer.java:539)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurrentExtendedMap$2.apply(DefaultDataContainer.java:536)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.compute(BoundedEquivalentConcurrentHashMapV8.java:3430)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurrentExtendedMap.compute(DefaultDataContainer.java:535)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.container.DefaultDataContainer.compute(DefaultDataContainer.java:255)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.persistence.PersistenceUtil.loadAndStoreInDataContainer(PersistenceUtil.java:90)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:216)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.CacheLoaderInterceptor.visitDataCommand(CacheLoaderInterceptor.java:147)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:101)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.EntryWrappingInterceptor.visitDataReadCommand(EntryWrappingInterceptor.java:130)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.EntryWrappingInterceptor.visitGetKeyValueCommand(EntryWrappingInterceptor.java:120)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitDataReadCommand(PessimisticLockingInterceptor.java:70)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitGetKeyValueCommand(AbstractLockingInterceptor.java:70)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:111)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:86)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:346)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:318)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.CacheMgmtInterceptor.visitDataReadCommand(CacheMgmtInterceptor.java:103)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.CacheMgmtInterceptor.visitGetKeyValueCommand(CacheMgmtInterceptor.java:91)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:97)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:102)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:71)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:86)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:40)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:336)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.cache.impl.CacheImpl.get(CacheImpl.java:430)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.cache.impl.CacheImpl.get(CacheImpl.java:422)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.schematic.internal.CacheSchematicDb.get(CacheSchematicDb.java:77)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.LocalDocumentStore.get(LocalDocumentStore.java:71)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.WorkspaceCache.documentFor(WorkspaceCache.java:188)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.WorkspaceCache.documentFor(WorkspaceCache.java:207)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.WorkspaceCache.getNode(WorkspaceCache.java:243)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.AbstractSessionCache.getNode(AbstractSessionCache.java:249)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.cache.document.WritableSessionCache.getNode(WritableSessionCache.java:183)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.JcrSession.node(JcrSession.java:500)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.AbstractJcrNode$ChildNodeResolver.nodeFrom(AbstractJcrNode.java:3621)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.modeshape.jcr.JcrChildNodeIterator.hasNext(JcrChildNodeIterator.java:104)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.apache.chemistry.opencmis.jcr.util.FilterIterator.hasNext(FilterIterator.java:50)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrFolder$1.hasNext(JcrFolder.java:593)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.util.FilterIterator.hasNext(FilterIterator.java:50)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrRepository.gatherDescendants(JcrRepository.java:1545)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrRepository.gatherDescendants(JcrRepository.java:1573)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrRepository.gatherDescendants(JcrRepository.java:1573)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrRepository.getDescendants(JcrRepository.java:846)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.jcr.JcrService.getDescendants(JcrService.java:134)[35:de.company.quala.components.cmis.web:1.4.13]

          at org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper.getDescendants(ConformanceCmisServiceWrapper.java:650)[35:de.company.quala.components.cmis.web:1.4.13]

          ... 26 more

      Caused by: java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50

          at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:754)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.schematic.internal.SchematicEntryLiteral$Externalizer.readObject(SchematicEntryLiteral.java:182)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.schematic.internal.SchematicEntryLiteral$Externalizer.readObject(SchematicEntryLiteral.java:171)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commons.marshall.jboss.JBossExternalizerAdapter.createExternal(JBossExternalizerAdapter.java:26)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1327)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commons.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:134)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.marshall.core.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:101)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.commons.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:80)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          at org.infinispan.marshall.core.MarshalledEntryImpl.unmarshall(MarshalledEntryImpl.java:114)[42:de.company.quala.components.contentrepository.modeshape-bundle:2.2.7]

          ... 86 more

      Caused by: an exception which occurred:

          in object of type org.infinispan.schematic.internal.SchematicEntryLiteral

       

       

      Our cache store is leveldb.

       

      Is it possible to delete this file and/or its parent somehow?

       

      I also found a similar problem: Google Groups

       

      Thank you,

      sprinz

        • 1. Re: StreamCorruptedException: Unexpected byte found when reading an object
          William Burns Expert

          Have you tried running a leveldb repair script on the corrupted file(s)?  This [1] sounds like the exact same thing as what you are seeing,  If compression is used it would change if a library needed to be linked or not.

           

          Also you mentioned

           

          If we try to access/delete/move the file, we get the following error/stacktrace:

          <stack-trace>

          I assume you mean you get this stack trace when you receive a request?  If not what is the error preventing user requests with the files left as they were?

           

          [1] Google Groups

          • 2. Re: StreamCorruptedException: Unexpected byte found when reading an object
            Simon Prinz Newbie

            Thanks for your help!

             

            I will try a python script to repair the leveldb, although I can't seem to find a recent script. The only script I can find is the one in the history of this page: Backup and Restore - Fedora 4.x Documentation - DuraSpace Wiki

             

            Can you link me to a more recent one?

             

            And you were right. We get this error, when we receive a request.

            • 3. Re: StreamCorruptedException: Unexpected byte found when reading an object
              Simon Prinz Newbie

              I tried running the linked leveldb repair script. Unfortunately it did not work. We still get the same error.

               

              Any other ideas?

               

              Thanks,

              sprinz

              • 4. Re: StreamCorruptedException: Unexpected byte found when reading an object
                Tristan Tarrant Master

                Simon,

                would it be acceptable to lose that entry (since it is corrupted) ? I was thinking of allowing the persistence manager to ignore corrupted cache entries and allow the underlying store to remove them without attempting to read them.

                • 5. Re: StreamCorruptedException: Unexpected byte found when reading an object
                  Simon Prinz Newbie

                  Hi Tristan,

                   

                  yes, that would be perfectly acceptable. Currently the users can not access any of their files...

                  Could you elaborate on how to allow the persistence manager to ignore corrupted cache entries?

                   

                  In the IRC channel someone (sorry, forgot the alias) mentioned something like this:

                  EmbeddedCacheManager cm = new DefaultCacheManager();

                  cm.getCache().getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).remove(object)

                   

                   

                  Greetings,

                  Simon

                  • 6. Re: StreamCorruptedException: Unexpected byte found when reading an object
                    William Burns Expert

                    Hello Simon,

                     

                    Unfortunately you can't really do that with the PersistenceManager, Tristan was more saying as a fix for future issues like this so a user wouldn't have to do any manual steps.

                     

                    The remove code should work assuming you can find the keys that are corrupted.  Unfortunately this means you will have to go one by one if there is more than one key that is corrupted.  Are you able to extract the keys from a log file to do this?  Just make sure you have the configuration pointing to the leveldb store.

                    • 7. Re: StreamCorruptedException: Unexpected byte found when reading an object
                      Simon Prinz Newbie

                      We are still trying to figure this out.

                       

                      We use the following code to retrieve the cache keyset in order to identify the corrupt object and delete it as mentioned before.

                       

                                  RepositoryProvider provider = RepositoryProvider.getInstance();

                                  Repository repository = provider.getRepository();

                                  // get utils

                                  RepositoryUtil repoUtil = RepositoryUtil.getInstance();

                                  OutputUtil outUtil = OutputUtil.getInstance();

                       

                                  // login

                                  Session session = repoUtil.login(repository);

                                  if (session == null) {

                                      return;

                                  }

                       

                                  org.modeshape.jcr.api.Session msSession = (org.modeshape.jcr.api.Session) session;

                                  org.modeshape.jcr.api.Repository repository2 = msSession

                                          .getRepository();

                       

                                  try {

                       

                                      EmbeddedCacheManager ecm = new DefaultCacheManager(

                                              ((JcrRepository) repository2).getConfiguration()

                                                      .getCacheConfiguration());

                                      Set<Object> keySet = ecm.getCache().getAdvancedCache().keySet();

                       

                                  } catch (Exception e) {

                                      // TODO Auto-generated catch block

                                      e.printStackTrace();

                       

                                  }

                       

                      First we had to set <jmx duplicate-domains="true"/> in the infinispan config, otherwise we would get this error:

                       

                      org.infinispan.jmx.JmxDomainConflictException: ISPN000034: There's already a JMX MBean instance type=CacheManager,name="DefaultCacheManager" already registered under 'org.infinispan' JMX domain. If you want to allow multiple instances configured with same JMX domain enable 'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element

                       

                      Unfortunately the keyset we get is always empty. Did we miss something?

                       

                      EDIT: It seems as if we need to get the already configured and running cache from the domain org.infinispan. Can someone explain to us, how to do that? As mentioned above, our code does not work (it just seems to create a new cache).

                       

                      EDIT2: Problem solved:

                       

                      EmbeddedCacheManager ecm = new DefaultCacheManager(

                                          "/home/.../infinispan_configuration.xml");

                                  ecm.getCache("name_of_cache").start();

                                  CloseableIteratorCollection<Object> values = ecm.getCache(

                                          "name_of_cache").keySet();