Uploaded image for project: 'Red Hat Data Grid'
  1. Red Hat Data Grid
  2. JDG-96

Cache events are incompatible with CDI 1.1 in JDG 7

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • JDG 7.2 DR2, JDG 7.2 GA
    • JDG 7.0.0 ER2, JDG 7.0.0 ER6, JDG 7.1.0 DR1, JDG 7.1.0 ER4, JDG 7.0.1 DR3
    • Spring integration
    • None
    • DR2
    • Workaround Exists
    • Hide

      The workaround of this bug requires attaching listeners manually (and removing them from CDI context):

      • Remove CDI annotations from your listener bean (please also remember about removing all @Observes annotations from methods)
      • Add Listener annotations on desired methods (e.g. @CacheStarted)
      • Manually register listeners using AdvancedCache#addListener
      • An example might be found here: https://github.com/slaskawi/219-reproducer/compare/workaround
      Show
      The workaround of this bug requires attaching listeners manually (and removing them from CDI context): Remove CDI annotations from your listener bean (please also remember about removing all @Observes annotations from methods) Add Listener annotations on desired methods (e.g. @CacheStarted ) Manually register listeners using AdvancedCache#addListener An example might be found here: https://github.com/slaskawi/219-reproducer/compare/workaround

      org.infinispan.cdi.test.event.CacheEventTest.arquillianBeforeTest fails with

      java.lang.RuntimeException: Could not inject members
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:135)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.enrich(CDIInjectionEnricher.java:78)
      	at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
      	at org.jboss.arquillian.container.test.impl.ClientTestInstanceEnricher.enrich(ClientTestInstanceEnricher.java:51)
      	at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
      	at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102)
      	at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84)
      	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65)
      	at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
      	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)
      	at org.jboss.arquillian.testng.Arquillian.arquillianBeforeTest(Arquillian.java:133)
      	at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
      	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
      	at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
      	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      	at org.testng.TestRunner.privateRun(TestRunner.java:767)
      	at org.testng.TestRunner.run(TestRunner.java:617)
      	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
      	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
      	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
      	at org.testng.SuiteRunner.run(SuiteRunner.java:254)
      	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      	at org.testng.TestNG.run(TestNG.java:1057)
      	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
      	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)
      	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)
      	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
      Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-000819: Cannot provide an event type parameterized with a type parameter org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent<?, ?>
      	at org.jboss.weld.event.ObserverNotifier$EventTypeCheck.load(ObserverNotifier.java:232)
      	at org.jboss.weld.event.ObserverNotifier$EventTypeCheck.load(ObserverNotifier.java:222)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
      	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
      	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
      	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
      	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
      	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
      	at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
      	at org.jboss.weld.event.ObserverNotifier.checkEventObjectType(ObserverNotifier.java:215)
      	at org.jboss.weld.event.EventImpl.selectEvent(EventImpl.java:134)
      	at org.jboss.weld.event.EventImpl.select(EventImpl.java:130)
      	at org.infinispan.cdi.event.cache.CacheEventBridge.registerObservers(CacheEventBridge.java:24)
      	at org.infinispan.cdi.AdvancedCacheProducer.getAdvancedCache(AdvancedCacheProducer.java:69)
      	at org.infinispan.cdi.InfinispanExtensionEmbedded$1.create(InfinispanExtensionEmbedded.java:96)
      	at org.infinispan.cdi.InfinispanExtensionEmbedded$1.create(InfinispanExtensionEmbedded.java:92)
      	at org.infinispan.cdi.util.ImmutableBean.create(ImmutableBean.java:65)
      	at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
      	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
      	at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
      	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
      	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:363)
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:374)
      	at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
      	at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
      	at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectNonContextualInstance(CDIInjectionEnricher.java:145)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:125)
      	... 67 more
      

              jsenko@redhat.com Jakub Senko
              vjuranek@redhat.com Vojtech Juranek
              Vojtech Juranek Vojtech Juranek
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: