8 Replies Latest reply on May 2, 2014 11:19 AM by Randall Hauch

    ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]

    nimit Agrawal Newbie

      Hi

       

      I am using JBOSS EAP 6.1.0 + Modeshape 3.7.1 +  Infinispan5.2.7.FINAL + MS SQLSERVER database .  it is working absolutely fine. I am able to store and retrieve data. I can also successfully take back up of the repository. But Problem occurs when i try to restore database.

       

      My modecfg.json:

       

      {
          "name": "Repop",
          "jndiName": "",
          "workspaces": {
              "predefined": ["workspace"],
              "default": "default",
              "allowCreation": true
          },
          "storage": {
              "cacheName": "Content",
              "binaryStorage": {
                  "type": "database",
                  "dataSourceJndiName": "java:/jcrDatasorce"
              }
          },
          "security": {
              "anonymous": {
                  "roles": ["readonly", "readwrite", "admin"],
                  "useOnFailedLogin": false
              }
          },
          "query": {
              "enabled": false
          }
      }
      
      

       

      Inifinispan cache creation :

       

      @Produces
          @ClusteredCacheContainer
          @ApplicationScoped
          public EmbeddedCacheManager getCacheContainer() {
           
              GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().disable().allowDuplicateDomains(true).transport().defaultTransport().clusterName(CONFIG_CLUSTER_NAME)
                      .nodeName(CONFIG_CLUSTER_NODE).build();
              return new DefaultCacheManager(globalConfig);
          }
      
      
        @Produces
          @ApplicationScoped
          public Repository createRepository() throws Exception {
      
      
              ConfigurationBuilder builder = new ConfigurationBuilder();
      
      
              ManagedConnectionFactoryConfigurationBuilder<JdbcStringBasedCacheStoreConfigurationBuilder> cacheConfig = builder.clustering().cacheMode(CacheMode.REPL_SYNC).transaction()
                      .transactionManagerLookup(new GenericTransactionManagerLookup()).transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.OPTIMISTIC).loaders()
                      .addLoader(JdbcStringBasedCacheStoreConfigurationBuilder.class).fetchPersistentState(false).ignoreModifications(false).purgeOnStartup(false).table().dropOnExit(false)
                      .createOnStart(false).tableNamePrefix("Modeshape").idColumnName("ID_COLUMN").idColumnType("VARCHAR(255)").dataColumnName("DATA_COLUMN").dataColumnType("VARBINARY(max)")
                      .timestampColumnName("TIMESTAMP_COLUMN").timestampColumnType("BIGINT").dataSource();
      
      
              cacheConfig.jndiUrl("java:/jcrDatasorce");
      
      
              org.infinispan.configuration.cache.Configuration cfg = cacheConfig.build();
      
      
              LocalEnvironment environment = new LocalEnvironment();
      
      
              environment.addCacheContainer(LocalEnvironment.DEFAULT_CONFIGURATION_NAME, cacheManager);
              environment.defineCache(CDICacheManagerConfig.CONFIG_CLUSTER_NODE, cfg);
      
      
              RepositoryConfiguration config = RepositoryConfiguration.read(CDIConfiguration.class.getClassLoader().getResource("modecfg.json"));
      
      
              config = config.with(environment);
      
      
              ModeShapeEngine engine = new ModeShapeEngine();
      
      
              org.modeshape.common.collection.Problems problems = config.validate();
      
      
              if (problems.hasErrors()) {
                  LOG.error("Problems starting the engine.");
                  LOG.error(problems.toString());
              }
      
      
              engine.start();
      
      
              final JcrRepository repo = engine.deploy(config);
      
      
              InitialContext ic = new InitialContext();
              ic.bind("jcr:/demolc", repo);
      
      
              return repo;
          }
      
      

       

       

      Code for restoring :

       

       public void restoreRepository() {
              Session session = null;
              File backUpDirectory = new File(Constants.JCR_BACKUP_DIR);
              try {
                  session = repository.login();
                  Problems problems = ((org.modeshape.jcr.api.Session) session).getWorkspace().getRepositoryManager().restoreRepository(backUpDirectory);
      
      
                  if (problems.hasProblems()) {
                      LOG.warn("There were following problems while restoring the jcr repository. ");
                      for (Problem problem : problems) {
                          LOG.warn(problem.getMessage());
                      }
                  } else {
                      LOG.debug("JCR repository restored successfully.");
                  }
      
      
              } catch (RepositoryException ex) {
                  LOG.error("Failed to create root nodes", ex);        }
          }
      

       

       

           This lines of this method are successfully executed. I can say this as debug LOG "JCR repository restored successfully." is printed.  However while exiting from this method i get exception.

       

      Exception StackTrace:

       

      15:47:36,445 DEBUG [com...multiplayer.configuration.service.node.ConfigRepositoryManager] (http-/0.0.0.0:8080-2) JCR repository restored successfully.

      15:47:36,446 WARN  [com.arjuna.ats.arjuna] (http-/0.0.0.0:8080-2) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff0a630b3a:7278820e:535f9ada:1aee, SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, lockedKeys=null, backupKeyLocks=null, topologyId=8, isFromStateTransfer=false} org.infinispan.transaction.synchronization.SyncLocalTransaction@f3} org.infinispan.transaction.synchronization.SynchronizationAdapter@112 >: org.infinispan.CacheException: Could not prepare.

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:70) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)

                                   at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

                                   at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:315) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at com...multiplayer.configuration.api.ConfigAdminService$$$view327.restoreRepository(Unknown Source) [configuration-api-1.0.3-SNAPSHOT.jar:1.0.3-SNAPSHOT]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]

                                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]

                                   at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]

                                   at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

                                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

                                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

                                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

                                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

                                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)

                                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

                                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

       

       

                                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)

                                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

                                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

                                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)

                                   at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

      Caused by: javax.transaction.xa.XAException

                                   at org.infinispan.transaction.TransactionCoordinator.rollback(TransactionCoordinator.java:204) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:159) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:123) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:68) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   ... 63 more

       

       

      15:47:36,457 WARN  [com.arjuna.ats.jta] (http-/0.0.0.0:8080-2) ARJUNA016029: SynchronizationImple.afterCompletion - failed for SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, lockedKeys=null, backupKeyLocks=null, topologyId=8, isFromStateTransfer=false} org.infinispan.transaction.synchronization.SyncLocalTransaction@f3} org.infinispan.transaction.synchronization.SynchronizationAdapter@112 with exception: org.infinispan.CacheException: Could not commit.

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.afterCompletion(SynchronizationAdapter.java:90) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:96)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:402)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:103)

                                   at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

                                   at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:315) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at com...multiplayer.configuration.api.ConfigAdminService$$$view327.restoreRepository(Unknown Source) [configuration-api-1.0.3-SNAPSHOT.jar:1.0.3-SNAPSHOT]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]

                                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]

                                   at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]

                                   at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

                                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

                                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

       

       

                                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

                                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

                                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)

                                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

                                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

                                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)

                                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

                                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

                                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)

                                   at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

      Caused by: javax.transaction.xa.XAException

                                   at org.infinispan.transaction.TransactionCoordinator.rollback(TransactionCoordinator.java:204) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.afterCompletion(SynchronizationAdapter.java:88) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   ... 63 more

       

       

      15:47:36,462 WARN  [com.arjuna.ats.arjuna] (http-/0.0.0.0:8080-2) ARJUNA012127: TwoPhaseCoordinator.afterCompletion - returned failure for SynchronizationImple< 0:ffff0a630b3a:7278820e:535f9ada:1aee, SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, lockedKeys=null, backupKeyLocks=null, topologyId=8, isFromStateTransfer=false} org.infinispan.transaction.synchronization.SyncLocalTransaction@f3} org.infinispan.transaction.synchronization.SynchronizationAdapter@112 >

      15:47:36,463 ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:8080-2) JBAS014134: EJB Invocation failed on component ConfigAdminServiceImpl for method public abstract void com...multiplayer.configuration.api.ConfigAdminService.restoreRepository(com...multiplayer.configuration.api.dto.ConfigBackupDTO) throws java.io.IOException: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:114) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:94) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:315) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                                   at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at com.multiplayer.configuration.api.ConfigAdminService$$$view327.restoreRepository(Unknown Source) [configuration-api-1.0.3-SNAPSHOT.jar:1.0.3-SNAPSHOT]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]

                                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]

                                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]

                                   at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]

                                   at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

                                   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]

       

       

                                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

                                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)

                                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

                                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

                                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)

                                   at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)

                                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)

                                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)

                                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)

                                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)

                                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

                                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)

                                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)

                                   at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

      Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

                                   at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)

                                   at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                                   ... 55 more

      Caused by: org.infinispan.CacheException: Could not prepare.

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:70) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)

                                   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)

                                   at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)

                                   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)

                                   ... 58 more

      Caused by: javax.transaction.xa.XAException

                                   at org.infinispan.transaction.TransactionCoordinator.rollback(TransactionCoordinator.java:204) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:159) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.TransactionCoordinator.prepare(TransactionCoordinator.java:123) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   at org.infinispan.transaction.synchronization.SynchronizationAdapter.beforeCompletion(SynchronizationAdapter.java:68) [infinispan-core-5.2.6.Final.jar:5.2.6.Final]

                                   ... 63 more

        • 1. Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
          Randall Hauch Master

          Are you (or the server) wrapping the call to "restoreRepository()" inside a transaction? Hopefully not. If you are, please try it without wrapping in a transaction. And if that works, then can you log an issue to have us update the restore logic to suspend any current transaction?

           

          BTW, I noticed that you're using OPTIMISTIC locking. That's fine so long as you can guarantee that your application is never attempting to concurrently update the same node from multiple threads/processes. But if you cannot make that guarantee, then we urge using PESSIMISTIC locking.

          • 2. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
            nimit Agrawal Newbie

            Hi Randall, Thanks for the quick response and sorry for my delayed response.

             

            I added @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) to my restore method and now i m not getting any error.

             

            But restore is clearing all my data which was stored even before backup.  All Node types are also gone.

             

            Test cases which is failing for me for ease:

             

            @Test
                public void testRestoreShouldRemoveAllDataAfterBackUp() {
            
            
                    configRepositoryManager.saveConfigNode("lctable", "1002", "google:lctable", Collections.singletonMap(TableTemplate.Properties.READER_TYPE.name(), new String[] { "This is a test table" }));
                    ConfigObject beforeBackupConfig = configRepositoryManager.getConfigNode("lctable/1002");
            
            
                    Assert.assertNotNull(beforeBackupConfig.getConfig());
            
            
                    configRepositoryManager.backUpRepository();
            
            
                    configRepositoryManager.saveConfigNode("lctable", "1001", "google:lctable", Collections.singletonMap(TableTemplate.Properties.READER_TYPE.name(), new String[] { "This is a test table" }));
                    ConfigObject afterBackupConfig = configRepositoryManager.getConfigNode("lctable/1001");
                    Assert.assertNotNull(afterBackupConfig.getConfig());
            
            
                    beforeBackupConfig = configRepositoryManager.getConfigNode("lctable/1002");
                    Assert.assertNotNull(beforeBackupConfig.getConfig());
            
            
                    configRepositoryManager.restoreRepository();
            
            
                    ConfigObject configNode1 = configRepositoryManager.getConfigNode("lctable/1001");
                    Assert.assertNull(configNode1.getConfig());
            
            
                    beforeBackupConfig = configRepositoryManager.getConfigNode("lctable/1002");
                    Assert.assertNotNull(beforeBackupConfig.getConfig()); // This is failing . lctable 1002 which was created before backup no more exist after restore
                }
            
            
                public ConfigObject getConfigNode(String path) {
                    Session session = null;
                
              session = repository.login();
              return createConfigObject(session.getRootNode().getNode(path));
                  }
            
            
                public ConfigObject createConfigObject(Node node) throws RepositoryException, IllegalStateException {
                    PropertyIterator properties = node.getProperties();
                    Map<String, String[]> props = new HashMap<>();
            
            
                    while (properties.hasNext()) {
            
            
                        Property property = properties.nextProperty();
            
            
                        if (property.isMultiple() && property.getValues() != null && property.getValues().length > 0) {
                            props.put(property.getName(), valuesToString(property.getValues()));
            
            
                        } else if (property.getString() != null) {
                            props.put(property.getName(), new String[] { property.getString() });
                        }
                    }
            
            
                    ConfigObject object = new ConfigObject();
                    object.setConfig(props);
                    object.setType(node.getPrimaryNodeType().getName());
                    return object;
                }
            
              public void saveConfigNode(String path, String name, String type, Map<String, String[]> properties) {
            
            
                    Session session = null;
                  
              session = repository.login();
            
            
              Node rootNode = session.getRootNode().getNode(path);
            
            
              Node nodeToSave = NodeUtils.createOrGet(rootNode, name, type);
            
            
              Map<String, PropertyDefinition> propertyDefinitionMap = NodeUtils.getPropertyDefinitionAsMap(nodeToSave.getPrimaryNodeType().getPropertyDefinitions());
            
            
              for (Map.Entry<String, String[]> entry : properties.entrySet()) {
              if (propertyDefinitionMap.containsKey(entry.getKey())) {
              PropertyDefinition propDef = propertyDefinitionMap.get(entry.getKey());
            
            
              if (propDef.isMultiple()) {
              nodeToSave.setProperty(entry.getKey(), entry.getValue(), propDef.getRequiredType());
            
            
              } else {
              nodeToSave.setProperty(entry.getKey(), entry.getValue()[0], propDef.getRequiredType());
              }
              }
              }
              session.save();
                }
            
            
            

             

             

            Please Help . Let me know what wrong i m doing

            • 3. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
              Randall Hauch Master

              I just verified that that this works properly when you restore into a new repository, and that it also works when you restore into the same repository. You can see my test case in this pull-request; it adds content to a repository, backs up the repository, adds more content (that will not be in the backup), restores the repository, and verifies that the newly-added content not in the backup is no longer in the restored repository. (There are two tests: one that restores into the same repository from which the backup was made, and one that restores into a new repository.)

               

              After reviewing your code above and without seeing your whole test case, I'm not sure what you're doing wrong. I do see that you're not logging out of your sessions in the "saveConfigNode" method (though you appear to always be creating new sessions); I'd suggest using a try-finally block to ensure you're always logging out of your sessions. Might you be keeping and using a session obtained before the backup was made, and using it after the restore? I'm not sure what would happen, but that's definitely not supported. We do say in our documentation that nothing can be using the repository during a restore.

              1 of 1 people found this helpful
              • 5. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
                nimit Agrawal Newbie

                Hi Randall,

                 

                I re-looked everything. And found that restore is working but i have to restart it before using it again.

                After restore i cannot see any data or user defined node types.

                But once i restart my server everything works fine. All data and nodetypes before backup are there.

                 

                Can it be related to caching.?

                • 6. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
                  Randall Hauch Master

                  Yes, it is related to caching. Quite a few of our services only reload their cached information (e.g., node types, namespaces, etc.) based upon events, but restoring never generates events (restore doesn't replay the history of changes).

                   

                  Feel free to log an enhancement for us to improve this by forcibly reloading all of the services' internal data. We'd probably only address this in the 4.x releases, though. In the mean time, you'll likely have to restart the repository (which you can do programmatically).

                  • 7. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
                    nimit Agrawal Newbie

                    Can u tell how to do that?(restarting programatically) ?

                     

                    Sorry if it is very dumb question I am very very new to this JCR thing and Modehape.

                    • 8. Re: Re: ModeShape Restore not working with infinispan.  [Caused by: org.infinispan.CacheException: Could not prepare. , Caused by: javax.transaction.xa.XAException]
                      Randall Hauch Master

                      You're using the ModeShape subsystem in EAP, which makes it a little harder. IIRC the only way to do that is to reload the whole server via the EAP CLI (see here).


                      Understandably this is not convenient, so please log that enhancement. It probably would also be good to log a second enhancement to provide a way of restarting the repository via the CLI.