Exception at DefaultCacheManager.getCache(String cacheName)
mvelanka Sep 11, 2015 5:46 AMHi,
I am trying to embed infinispan in my java web application, using Maven Dependency injection. The web application is hosted on Tomcat 8 web server. While the application works seamlessly, even with successful cache operations on my local Laptop (Windows 7), it fails to start on the Integration Server (which is a Windows VM). I am using Programmatic configuration for initializing the cache manager, and trying to get the cache from it, as below:
ConfigurationBuilder configBuilder = new ConfigurationBuilder();
configBuilder.clustering().cacheMode(CacheMode.LOCAL);
// configBuilder.eviction().strategy(EvictionStrategy.LRU).type(EvictionType.MEMORY);
// configBuilder.expiration().lifespan(24, TimeUnit.HOURS);
configBuilder.invocationBatching().enable();
cacheManager = new DefaultCacheManager(configBuilder.build());
Cache<String, Object> baseCache = cacheManager.getCache("baseCache");
I am doing this at Tomcat startup, in the contextInitialized method of ServletContextListener.
On the Windows VM server, there is an exception thrown at the line: Cache<String, Object> baseCache = cacheManager.getCache("baseCache");
The exception stacktrace is as below:
10-Sep-2015 20:28:06.515 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.bmc.zso.iris.sl.launcher.StartupHook
org.infinispan.CacheException: Unable to invoke method public void org.infinispan.marshall.jboss.ExternalizerTable.start() on object of type ExternalizerTable
at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:207)
at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889)
at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:658)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:227)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:162)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:297)
at org.infinispan.factories.ComponentRegistry.getOrCreateComponent(ComponentRegistry.java:165)
at org.infinispan.factories.AbstractComponentRegistry.invokeInjectionMethod(AbstractComponentRegistry.java:247)
at org.infinispan.factories.AbstractComponentRegistry.access$000(AbstractComponentRegistry.java:87)
at org.infinispan.factories.AbstractComponentRegistry$Component.injectDependencies(AbstractComponentRegistry.java:817)
at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:221)
at org.infinispan.factories.ComponentRegistry.registerComponentInternal(ComponentRegistry.java:192)
at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:176)
at org.infinispan.factories.InternalCacheFactory.bootstrap(InternalCacheFactory.java:104)
at org.infinispan.factories.InternalCacheFactory.createAndWire(InternalCacheFactory.java:82)
at org.infinispan.factories.InternalCacheFactory.createCache(InternalCacheFactory.java:66)
at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:681)
at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:648)
at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:544)
at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:517)
at com.bmc.zso.iris.cache.admin.NamedCacheManager.<init>(NamedCacheManager.java:44)
at com.bmc.zso.iris.cache.admin.NamedCacheManager.getNamedCacheManager(NamedCacheManager.java:63)
at com.bmc.zso.iris.cache.admin.NamedCacheManager.initCacheManager(NamedCacheManager.java:57)
at com.bmc.zso.iris.sl.launcher.StartupHook.contextInitialized(StartupHook.java:40)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: org.infinispan.tree.impl.NodeKey$Externalizer cannot be cast to org.infinispan.marshall.AdvancedExternalizer
at org.infinispan.marshall.jboss.ExternalizerTable.loadForeignMarshallables(ExternalizerTable.java:347)
at org.infinispan.marshall.jboss.ExternalizerTable.start(ExternalizerTable.java:167)
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:205)
... 84 more
Is this something to do with some Infinispan configuration, or something I need to fix in the code. Interestingly, the code runs great on my local laptop with same Tomcat version. I initialize the cachemanager, get an instance of cache, put some things into it, and able to retrieve them back successfully, so I doubt something is wrong with the code?