Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2078

InvalidItemState after some rollbacks with XA Resource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.4, 1.5.4
    • None
    • None

    Description

      I modified a versionable node and do a rollback, after 3 to 10 iterations the test will fail.

      Here is a simple testcase to demonstrate the situation.

      import junit.framework.TestCase;
      import org.apache.jackrabbit.core.RepositoryImpl;
      import org.apache.jackrabbit.core.config.RepositoryConfig;
      import org.springframework.core.io.ClassPathResource;
      import org.springmodules.jcr.jackrabbit.support.JackRabbitUserTransaction;
      import org.xml.sax.InputSource;

      import javax.jcr.*;
      import java.io.File;

      public class NoSuchItemStateExceptionTest extends TestCase {

      private static final File TARGET = new File("target");
      private static final String REPO_HOME = "repository-lock-test";

      public void testIt2() throws Exception {

      RepositoryConfig config =
      RepositoryConfig.create(new InputSource(new ClassPathResource("repository.xml").getInputStream()),
      REPO_HOME);

      final Repository repository = RepositoryImpl.create(config);
      SimpleCredentials credentials = new SimpleCredentials("1", "1".toCharArray());
      Session sess = repository.login(credentials);

      for (int i = 0; i < 100; i++)

      { JackRabbitUserTransaction tx = new JackRabbitUserTransaction(sess); tx.begin(); System.out.println("i=" + i); Node root = sess.getRootNode(); createNode(sess, root); tx.rollback(); }

      }

      void createNode(Session sess, Node root) throws RepositoryException

      { Node nodeType = root.addNode("first"); Node n = nodeType.addNode("second"); n.addMixin("mix:versionable"); Node n2 = nodeType.addNode("second2"); n2.addMixin("mix:versionable"); sess.save(); }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jmelzer Juergen Melzer
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: