7 Replies Latest reply on Apr 5, 2011 3:10 PM by rocketraman

    Cannot disable transaction manager

    rocketraman

      I am running Infinispan 4.2.1 in an unmanaged environment and would like to disable the transaction manager. However, I get an exception on startup no matter how I configure the <transaction/> element in the infinispan.xml file, or even after programmatically calling:

       

      cacheManager.getDefaultConfiguration().setTransactionManagerLookup(null);

      cacheManager.getDefaultConfiguration().setTransactionManagerLookupClass(null);

       

      Here is the exception:

       

      Exception in thread "main" org.infinispan.CacheException: Unable to invoke method private void org.infinispan.transaction.xa.TransactionTable.start() on object

           at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:174)

           at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889)

           at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:687)

           at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:589)

           at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:147)

           at org.infinispan.CacheDelegate.start(CacheDelegate.java:323)

           at mypackageInfinispanCacheStore.initCache(InfinispanCacheStore.java:114)

           at mypackage.InfinispanCacheStore.init(InfinispanCacheStore.java:85)

           at mypackage.InfinispanCacheStore.main(InfinispanCacheStore.java:380)

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

           at java.lang.reflect.Method.invoke(Method.java:597)

           at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

      Caused by: java.lang.reflect.InvocationTargetException

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

           at java.lang.reflect.Method.invoke(Method.java:597)

           at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:171)

           ... 13 more

      Caused by: java.lang.NullPointerException

           at org.infinispan.manager.DefaultCacheManager.addListener(DefaultCacheManager.java:562)

           at org.infinispan.transaction.xa.TransactionTable.start(TransactionTable.java:105)

           ... 18 more

       

      Is there any way to simply disable the transaction manager?

       

      Thanks,

      Raman

        • 1. Cannot disable transaction manager
          an1310

          What's your use case that you need to disable the transaction manager?  Normally, if you're in an unmanaged environment, the transaction manager lookup will default to a DummyTransactionManager, which operates in memory.

           

          You can simply use the cache operations in a non-transactional context; you have to explicitly start a transaction before the transaction manager is involved.

          • 2. Re: Cannot disable transaction manager
            rocketraman

            I confirmed that the DummyTransactionManagerLookup class is being used -- but even with DummyTransactionManager, the xa.TransactionTable class throws the Exception I noted.

             

            This happens at cache start time -- not when an entry is placed into the cache.

             

            Also -- one further data point: the exception is thrown when I am connected to a client's network via VPN, but not otherwise. The VPN is a completely different subnet however, and JGroups is configured to bind to localhost so AFAICT the VPN should not be a factor. However, for some reason it is. I looked through the code for the various TransactionManagerLookup classes and can find no reason for the extra network interface to be causing an issue.

             

            PS I don't really care about "disabling" the transaction manager -- I'm just trying to find a workaround to this Exception when calling cache.start() and thought that would be a fair approach considering I don't need transactions. However, I am open to other suggestions.

            • 3. Cannot disable transaction manager
              an1310

              Right -- my question is why are you doing these two lines?

               

              cacheManager.getDefaultConfiguration().setTransactionManagerLookup(null);

              cacheManager.getDefaultConfiguration().setTransactionManagerLookupClass(null);

               

              You shouldn't need to do this.

               

              What version of 4.2.1 is this?  Also it would help if you post the relevant bits of your cache config.  For instance, I see there's a cache loader involved? 

               

              And I've run ISPN across VPNs without issue.

              • 4. Re: Cannot disable transaction manager
                rocketraman

                I simply added those to try and prevent Infinispan from throwing an exception related to XA transactions that I am not even using. I am quite happy to remove them but it doesn't solve the problem , which was why I was experimenting with them in the first place.

                 

                Version: 4.2.1-FINAL

                 

                Here is the cache config -- all cache loader config, if any, is defaulted by Infinispan AFAIK:

                 

                http://pastebin.com/MH45BCsM

                • 5. Cannot disable transaction manager
                  rocketraman

                  Attaching a debugger to the process shows the issue is with initializing the JGroups channel in the presence of the VPN -- Infinispan simply handles the error poorly by logging an ERROR-level message about it being unable to create the JGroups channel (without giving any details as to the underlying exception), and then continuing -- which then causes further exceptions later in the initialization process (TransactionTable.start(), as in my original post).

                   

                  What would have been really helpful is for Infinispan to show me the stack for the causal error, which is the JGroups initialization error, by bubbling up that exception all the way to my code, rather than the unrelated TransactionTable.start error.

                   

                  Cheers,
                  Raman

                  • 6. Cannot disable transaction manager
                    an1310

                    That would explain it.  Did you write a JIRA for this issue?

                    • 7. Cannot disable transaction manager
                      rocketraman

                      Some more information -- turns out Infinispan is reporting the correct exception after all, but only the first time. Upon retry even when the underlying reason for the JGroups init is removed, the CacheManager configuration has been "corrupted" and is no longer usable.

                       

                      I created this JIRA entry:

                       

                      https://issues.jboss.org/browse/ISPN-1034