0 Replies Latest reply on Aug 4, 2014 7:51 AM by poirot

    empty repository after restore

    poirot

      we currently want to migrate from jboss as 7.1.1 modeshape 3.1.3 to

      eap 6.1, modeshape 3.7.2 using the backup and restore methods

      from the modeshape RepositoryManager

       

      it worked very well with all our small test repositories and we were

      confident that it will be an easy task .. but at least we tried a lot

      of things and we didn't manage to get the backup of our production system

      to run. not even that it doesn't work with the new jboss 6.1/3.7.2, it also

      doesn't work with the same configuration(as7.1.1/3.1.3) the backup was made.

       

      no exception are thrown and no problems are reported by the backup/restore methods,

      but the repository is nevertheless empty after the restore.

       

      so we guess, there must be a fundamental problem with our configuration/code and

      hope, someone could help us and point out that issue ...

       

      our configuration is:

      
      <cache-container name="modeshape">
        <local-cache name="var-cr-01">
        <transaction mode="NON_XA" locking="PESSIMISTIC"/>
        <file-store relative-to="jboss.server.data.dir" path="modeshape/store/var-cr-01" passivation="false" purge="false"/>
        </local-cache>
      
      <security-domain name="modeshape-security" cache-type="default">
        <authentication>
        <login-module code="UsersRoles" flag="required">
        <module-option name="usersProperties" value="modeshape-users.properties"/>
        <module-option name="rolesProperties" value="modeshape-roles.properties"/>
        </login-module>
        </authentication>
      
      <subsystem xmlns="urn:jboss:domain:modeshape:1.0">
        <repository name="var-cr-01" cache-name="var-cr-01" cache-container="modeshape"/>
      
      

       

      our backup/restore code:

       

      @Resource(name="java:/jcr/var-cr-01")
      protected Repository repository;
      
          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
          public void backupRepository(String prefix) throws LoginException, RepositoryException {
              log.info("backup to: "+prefix);
              String backupPAth = configService.getString( ConfigurationService.JCR_BACKUP_DIRECTORY );
              Session session = repository.login(new SimpleCredentials("adm", "somepw".toCharArray()));
              RepositoryManager man =
                      session.getWorkspace().getRepositoryManager();
              String filename = backupPAth +"/b_" +prefix+".dmp";
              log.info("backup to: "+filename);
              man.backupRepository( new File(filename));
              Problems ps = man.restoreRepository( new File(filename));
              if ( ps != null ){
                  log.warn("backup found {} problems",ps.size() );
                  for ( Problem p : ps ){
                      log.warn("backup problem: {}",p.getMessage() );
                  }
              }
              log.info("backup finished to: "+filename);
          }
      
          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
          public void restoreRepository(String prefix) throws LoginException, RepositoryException,OperationFailedException {
              String backupPAth = configService.getString( ConfigurationService.JCR_RESTORE_DIRECTORY );
              String backupFile = prefix;
              if ( backupFile == null || backupFile.length()==0){
                  backupFile = configService.getString( ConfigurationService.JCR_RESTORE_FILENAME );
              }
              String filename = backupPAth+"/"+backupFile;
              log.info("restore from: "+filename);
              try {
                  Session session = repository.login(new SimpleCredentials("adm", "somepw".toCharArray()));
                  RepositoryManager man =
                          session.getWorkspace().getRepositoryManager();
                  Problems ps = man.restoreRepository( new File(filename));
                  if ( ps != null ){
                      log.warn("restore found {} problems",ps.size() );
                      for ( Problem p : ps ){
                          log.warn("restore problem: {}",p.getMessage() );
                      }
                  }
                  //session.save(); session isn't valid anymore!
              } catch ( Exception e ){
                  log.error( "failed to restore: "+filename, e);
                  throw new OperationFailedException("failed to restore: "+filename, e );
              }
              log.info("restored from: "+filename);
      }
          }
      
      
      

       

      the server logs are attached