Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2371

Failed login to non-default workspace in 3.8 with JTA

    XMLWordPrintable

Details

    • Hide
      public class JBossTransactionsTest extends SingleUseAbstractTest {
      
          @Test
          public void testStartRepositoryWithinTransaction() throws Exception {
              InputStream configStream = getClass().getClassLoader().getResourceAsStream("config/repo-config-inmemory-jbosstxn-other-wp.json");
              RepositoryConfiguration config = RepositoryConfiguration.read(configStream, REPO_NAME).with(environment);
              repository = new JcrRepository(config);
              repository.start();
              TransactionManager txman = repository.transactionManager();
              txman.begin();
              Session session1 = repository.login("otherWorkspace");
              session1.logout();
              txman.commit();
          }
      
          protected boolean startRepositoryAutomatically() {
              return false;
          }
      }
      

      repo-config-inmemory-jbosstxn-other-wp.json:

      {
          "name" : "In Memory Repository",
          "storage" : {
              "cacheName" : "inmemoryRepository",
              "cacheConfiguration" : "config/infinispan-inmemory-jbosstxn.xml",
          },
          "workspaces" : {
              "predefined" : ["otherWorkspace"],
              "default" : "default",
              "allowCreation" : true
          },
          "security" : {
              "anonymous" : {
                  "roles" : ["readonly","readwrite","admin"],
                  "useOnFailedLogin" : false
              }
          },
      }
      
      Show
      public class JBossTransactionsTest extends SingleUseAbstractTest { @Test public void testStartRepositoryWithinTransaction() throws Exception { InputStream configStream = getClass().getClassLoader().getResourceAsStream( "config/repo-config-inmemory-jbosstxn-other-wp.json" ); RepositoryConfiguration config = RepositoryConfiguration.read(configStream, REPO_NAME).with(environment); repository = new JcrRepository(config); repository.start(); TransactionManager txman = repository.transactionManager(); txman.begin(); Session session1 = repository.login( "otherWorkspace" ); session1.logout(); txman.commit(); } protected boolean startRepositoryAutomatically() { return false ; } } repo-config-inmemory-jbosstxn-other-wp.json: { "name" : "In Memory Repository", "storage" : { "cacheName" : "inmemoryRepository", "cacheConfiguration" : "config/infinispan-inmemory-jbosstxn.xml", }, "workspaces" : { "predefined" : ["otherWorkspace"], "default" : "default", "allowCreation" : true }, "security" : { "anonymous" : { "roles" : ["readonly","readwrite","admin"], "useOnFailedLogin" : false } }, }

    Description

      ModeShape throws exception on login to non-default workspace, was not yet initialized, if transaction is active.
      Default workspace initialized successfully when repository starts with suspend global transaction.
      Affected only current 3.8-SNAPSHOT

      JBossTransactionsTest
      org.modeshape.jcr.JBossTransactionsTest
      testStartRepositoryWithinTransaction(org.modeshape.jcr.JBossTransactionsTest)
      org.modeshape.common.SystemFailureException: java.lang.IllegalStateException: Active transaction detected, but the Infinispan cache isn't aware of it
      	at org.modeshape.jcr.cache.RepositoryCache.runInTransaction(RepositoryCache.java:490)
      	at org.modeshape.jcr.cache.RepositoryCache.workspace(RepositoryCache.java:912)
      	at org.modeshape.jcr.cache.RepositoryCache.getWorkspaceCache(RepositoryCache.java:1124)
      	at org.modeshape.jcr.JcrSession.<init>(JcrSession.java:188)
      	at org.modeshape.jcr.JcrXaSession.<init>(JcrXaSession.java:49)
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:700)
      	at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:626)
      	at org.modeshape.jcr.JBossTransactionsTest.testStartRepositoryWithinTransaction(JBossTransactionsTest.java:23)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.IllegalStateException: Active transaction detected, but the Infinispan cache isn't aware of it
      	at org.modeshape.jcr.txn.SynchronizedTransactions.begin(SynchronizedTransactions.java:126)
      	at org.modeshape.jcr.cache.RepositoryCache.runInTransaction(RepositoryCache.java:480)
      	... 35 more
      

      Before MODE-2364 it throws NPE.

      Attachments

        1. login-tx.patch
          2 kB
          Igor Bezrukov

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            bIgorek Igor Bezrukov (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: