2 Replies Latest reply on Sep 2, 2019 8:40 AM by galder.zamarreno

    Problem initializing Infinispan

    gbrown1

      Hi all,

       

      I'm currently using Infinispan as a second-level cache for Hibernate in Wildfly 17 (we were previously using Ehcache). Although the code generally runs in the application server, we do have a few classes that need to run standalone as unit tests.

       

      When running these tests, I am seeing the following exception at startup. It seems that the code is looking for a start() method on the org.infinispan.notifications.cachemanagerlistener.CacheManagerNotifierImpl class. However, this method does not exist, which ultimately triggers the exception when the superclass traversal reaches java.lang.Object:

       

      ...

      Caused by: java.lang.NoSuchMethodException: java.lang.Object.start()

      at java.lang.Class.getDeclaredMethod(Class.java:2130) ~[?:1.8.0_201]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:91) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:96) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:96) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:96) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:96) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.commons.util.ReflectionUtil.findMethod(ReflectionUtil.java:96) ~[infinispan-commons-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.components.SecurityActions.getMethod(SecurityActions.java:24) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.components.ComponentMetadataRepo.initLifecycleMethods(ComponentMetadataRepo.java:248) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.components.ComponentMetadataRepo.initMetadata(ComponentMetadataRepo.java:130) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.components.ComponentMetadataRepo.getComponentMetadata(ComponentMetadataRepo.java:119) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.impl.BasicComponentRegistryImpl.getMetadataForComponent(BasicComponentRegistryImpl.java:365) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.impl.BasicComponentRegistryImpl.registerComponent(BasicComponentRegistryImpl.java:344) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.factories.impl.BasicComponentRegistryImpl.replaceComponent(BasicComponentRegistryImpl.java:406) ~[infinispan-core-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator.addToCache(PutFromLoadValidator.java:226) ~[infinispan-hibernate-cache-commons-9.4.14.Final.jar:9.4.14.Final]

      at org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:172) ~[infinispan-hibernate-cache-commons-9.4.14.Final.jar:9.4.14.Final]

      at org.infinispan.hibernate.cache.commons.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:129) ~[infinispan-hibernate-cache-commons-9.4.14.Final.jar:9.4.14.Final]

      at org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl.prepareForValidation(DomainDataRegionImpl.java:159) ~[infinispan-hibernate-cache-v53-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl.createAccessDelegate(DomainDataRegionImpl.java:149) ~[infinispan-hibernate-cache-v53-9.4.13.Final.jar:9.4.13.Final]

      at org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl.getEntityDataAccess(DomainDataRegionImpl.java:93) ~[infinispan-hibernate-cache-v53-9.4.13.Final.jar:9.4.13.Final]

      at org.hibernate.cache.internal.EnabledCaching.prime(EnabledCaching.java:130) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.metamodel.internal.MetamodelImpl.primeSecondLevelCacheRegions(MetamodelImpl.java:331) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:160) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]

      at com.viviport.business.services.mda.BaseMdaSessionFactory.getSessionFactory(BaseMdaSessionFactory.java:329) ~[main/:?]

      at com.viviport.business.services.mda.BaseMdaSessionFactory.setUnmanagedSessionFactory(BaseMdaSessionFactory.java:284) ~[main/:?]

      at com.viviport.business.services.mda.BaseMdaSessionFactory.setUnmanagedSessionFactory(BaseMdaSessionFactory.java:277) ~[main/:?]

      at com.viviport.business.services.mda.BaseMdaSessionFactory.getUnmanagedSessionFactory(BaseMdaSessionFactory.java:266) ~[main/:?]

      at com.viviport.business.services.mda.BaseMdaSessionFactory.getSessionFactory(BaseMdaSessionFactory.java:260) ~[main/:?]

      at com.viviport.business.services.mda.database.MdaSessionFactory.openSession(MdaSessionFactory.java:142) ~[main/:?]

      at com.viviport.business.services.mda.database.MdaSessionFactory.openSession(MdaSessionFactory.java:127) ~[main/:?]

      at com.viviport.business.services.mda.database.MdaSessionFactory.openSession(MdaSessionFactory.java:101) ~[main/:?]

      at com.viviport.business.services.mda.service.BaseMdaService.getMdaSession(BaseMdaService.java:809) ~[main/:?]

      at com.viviport.business.services.mda.service.BaseMdaService.getMdaSession(BaseMdaService.java:800) ~[main/:?]

      at com.viviport.business.services.mda.service.BaseMdaService.getMdaSession(BaseMdaService.java:744) ~[main/:?]

      at com.viviport.business.services.mda.service.BaseMdaService.initialize(BaseMdaService.java:653) ~[main/:?]

      at com.viviport.business.services.mda.service.VportMdaService.<init>(VportMdaService.java:59) ~[main/:?]

      at com.viviport.business.services.mda.service.StandaloneMdaService.<init>(StandaloneMdaService.java:33) ~[main/:?]

      at com.viviport.business.spring.config.StandaloneConfig.mdaService(StandaloneConfig.java:62) ~[main/:?]

      at com.viviport.business.spring.config.StandaloneConfig$$EnhancerBySpringCGLIB$$fac1b075.CGLIB$mdaService$0(<generated>) ~[main/:?]

      at com.viviport.business.spring.config.StandaloneConfig$$EnhancerBySpringCGLIB$$fac1b075$$FastClassBySpringCGLIB$$be3c35c8.invoke(<generated>) ~[main/:?]

      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at com.viviport.business.spring.config.StandaloneConfig$$EnhancerBySpringCGLIB$$fac1b075.mdaService(<generated>) ~[main/:?]

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]

      at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]

      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1248) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:668) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1248) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]

      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]

      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]

      at com.viviport.business.spring.BusinessApplicationContextHolder.initInstance(BusinessApplicationContextHolder.java:82) ~[main/:?]

      at com.viviport.business.spring.BusinessApplicationContextHolder.getInstance(BusinessApplicationContextHolder.java:69) ~[main/:?]

      at com.viviport.business.spring.TestContextInitializer.initialize(TestContextInitializer.java:19) ~[test/:?]

      at com.viviport.business.spring.TestContextInitializer.initialize(TestContextInitializer.java:1) ~[test/:?]

      at org.springframework.test.context.support.AbstractContextLoader.invokeApplicationContextInitializers(AbstractContextLoader.java:170) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.support.AbstractContextLoader.prepareContext(AbstractContextLoader.java:138) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:122) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:275) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

      ... 38 more

       

      I'm currently reviewing the Infinispan documentation to try to find a solution, but I figured I would post here in the meantime in case anyone has any suggestions.

       

      Thanks for your help,

      Greg

        • 1. Re: Problem initializing Infinispan
          gbrown1

          I was able to resolve my issue by disabling the second level Hibernate cache.

          • 2. Re: Problem initializing Infinispan
            galder.zamarreno

            Hmmm, that's a really odd issue. Did you verify that you don't have multiple Infinispan versions in the same classpath? You can check that with maven dependency tree.

             

            It could be that the testsuite loads metadata for an Infinispan version that's older, and then it tries to use this outdated information with a newer Infinispan version.

             

            You can take the Hibernate Infinispan simple tutorial, adjust it for the Infinispan and Hibernate versions highlighted in the logs (9.4.13.Final and 5.4.2.Final respectively) and the example works fine.