2 Replies Latest reply on Dec 4, 2009 10:27 AM by Jarek Odzga

    Example problem

    Jarek Odzga Newbie

      Hi,

      I'm getting the following exception:

      Exception in thread "main" org.infinispan.CacheException: Unable to invoke method public void org.infinispan.statetransfer.StateTransferManagerImpl.start() throws org.infinispan.statetransfer.StateTransferException on object
      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:173)
      at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:846)
      at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:666)
      at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:572)
      at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:147)
      at org.infinispan.CacheDelegate.start(CacheDelegate.java:303)
      at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:394)
      at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:358)
      at Test.main(Test.java:25)
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:170)
      ... 8 more
      Caused by: java.lang.NullPointerException
      at org.infinispan.statetransfer.StateTransferManagerImpl.start(StateTransferManagerImpl.java:123)
      ... 13 more

      If I understand correctly, this is because I 'm using non-clustered cache manager, while I should be using clustered one. I'm obtaining cache manager using configuration file. What am I doing wrong?

      I have the following code:

       CacheManager manager = new DefaultCacheManager("sample-configurations.xml");
       Cache<Integer, String> cache = manager.getCache("ReplicatedTX");
      


      and the following configuration from interactive tutorial:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
      
       <!-- *************************** -->
       <!-- System-wide global settings -->
       <!-- *************************** -->
      
       <global>
       <shutdown hookBehavior="DEFAULT"/>
       </global>
      
       <!-- ************************************** -->
       <!-- Individually configured "named" caches -->
       <!-- ************************************** -->
      
       <namedCache name="Local"/>
      
       <namedCache name="LocalTX">
       <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.DummyTransactionManagerLookup"/>
       </namedCache>
      
       <namedCache name="CacheStore">
       <loaders passivation="false" shared="false" preload="true">
       <loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="true"
       ignoreModifications="false" purgeOnStartup="false">
       <properties>
       <property name="location" value="/tmp"/>
       </properties>
       </loader>
       </loaders>
       </namedCache>
      
       <namedCache name="Eviction">
       <eviction wakeUpInterval="500" maxEntries="2" strategy="FIFO"/>
       </namedCache>
       <namedCache name="CacheStoreEviction">
       <loaders passivation="false" shared="false" preload="true">
       <loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="true"
       ignoreModifications="false" purgeOnStartup="false">
       <properties>
       <property name="location" value="/tmp"/>
       </properties>
       </loader>
       </loaders>
       <eviction wakeUpInterval="500" maxEntries="2" strategy="FIFO"/>
       </namedCache>
       <namedCache name="ReplicatedTX">
       <clustering mode="replication">
       <sync replTimeout="20000"/>
       <stateRetrieval timeout="20000" fetchInMemoryState="true"/>
       </clustering>
       </namedCache>
      </infinispan>