5 Replies Latest reply on Feb 3, 2017 9:16 AM by Galder Zamarreño

    jcache sample on wildfly-10.1 with infinispan-9.0.0.beta1 modules produces ClassNotFoundException

    Radim Hanus Expert

      Hi,

       

      recently I started to write some jsr107 samples and I have encountered a problem for which I cannot find an easy solution

       

      I use both custom key and value classes in a sample for method setStoreByValue(boolean) of javax.cache.configuration.MutableConfiguration

      but if you uncomment method testImmutable() in the test then CNFE is produced, see stacktrace bellow

       

      I know this is a wildlfy classloading specific problem but as jsr107 states I suppose that both serializable key and value classes are enough to comply with the specification:

      The mechanism an implementation uses to make a copy of the keys and values for an entry may be customizable. However to ensure application portability implementations must allow applications to solely make use of standard Java Serialization. Implementations must not obligate applications to adopt non-standard Java Serialization.

      I appreciate any hint,

      Radim

       

      testImmutable(org.javaee8.jcache.configuration.KeyValueServiceTest)  Time elapsed: 0.663 sec  <<< ERROR!

      javax.cache.CacheException: org.infinispan.commons.CacheException: java.lang.ClassNotFoundException: org.javaee8.jcache.configuration.MyValue from [Module "org.infinispan.jcache:ispn-9.0" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /opt/jboss/wildfly-10.1.0.Final-javaee8/modules,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base/.overlays/layer-base-wildfly-10-weld-3.0,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base))]

        at org.infinispan.jcache.Exceptions.launderException(Exceptions.java:68)

        at org.infinispan.jcache.embedded.JCache.doGet(JCache.java:189)

        at org.infinispan.jcache.embedded.JCache.get(JCache.java:179)

        at org.javaee8.jcache.configuration.KeyValueService.get(KeyValueService.java:47)

        at org.javaee8.jcache.configuration.KeyValueServiceTest.testImmutable(KeyValueServiceTest.java:42)

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

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

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

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

        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

        at org.jboss.arquillian.junit.Arquillian$8$1.invoke(Arquillian.java:379)

        at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        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.core.impl.ManagerImpl.fire(ManagerImpl.java:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

        at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        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.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        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.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:136)

        at org.jboss.arquillian.junit.Arquillian$8.evaluate(Arquillian.java:372)

        at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:246)

        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)

        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)

        at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:260)

        at org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:324)

        at org.jboss.arquillian.container.test.impl.execution.BeforeLifecycleEventExecuter.on(BeforeLifecycleEventExecuter.java:35)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        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.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)

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

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

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

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

        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)

        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.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)

        at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:317)

        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

        at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:205)

        at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)

        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)

        at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)

        at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:170)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:135)

        at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:98)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)

        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)

        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)

        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)

        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: org.jboss.arquillian.test.spi.ArquillianProxyException: org.infinispan.commons.CacheException : java.lang.ClassNotFoundException: org.javaee8.jcache.configuration.MyValue from [Module "org.infinispan.jcache:ispn-9.0" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /opt/jboss/wildfly-10.1.0.Final-javaee8/modules,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base/.overlays/layer-base-wildfly-10-weld-3.0,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base))] [Proxied because : Original exception caused: class java.lang.ClassNotFoundException: org.infinispan.commons.CacheException]

        at org.infinispan.interceptors.impl.MarshallerConverter.unboxKey(MarshallerConverter.java:32)

        at org.infinispan.interceptors.impl.MarshallerConverter.unboxValue(MarshallerConverter.java:38)

        at org.infinispan.cache.impl.TypeConverterDelegatingAdvancedCache.unboxValue(TypeConverterDelegatingAdvancedCache.java:81)

        at org.infinispan.cache.impl.TypeConverterDelegatingAdvancedCache.get(TypeConverterDelegatingAdvancedCache.java:379)

        at org.infinispan.jcache.embedded.JCache.doGet(JCache.java:184)

        ... 151 more

      Caused by: java.lang.ClassNotFoundException: org.javaee8.jcache.configuration.MyValue from [Module "org.infinispan.jcache:ispn-9.0" from local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: /opt/jboss/wildfly-10.1.0.Final-javaee8/modules,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base/.overlays/layer-base-wildfly-10-weld-3.0,/opt/jboss/wildfly-10.1.0.Final-javaee8/modules/system/layers/base))]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:348)

        at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:131)

        at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:112)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:948)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1255)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)

        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)

        at org.infinispan.marshall.core.ExternalJBossMarshaller.objectFromObjectStream(ExternalJBossMarshaller.java:46)

        at org.infinispan.marshall.core.GlobalMarshaller.readUnknown(GlobalMarshaller.java:859)

        at org.infinispan.marshall.core.GlobalMarshaller.readNonNullableObject(GlobalMarshaller.java:683)

        at org.infinispan.marshall.core.GlobalMarshaller.readNullableObject(GlobalMarshaller.java:361)

        at org.infinispan.marshall.core.GlobalMarshaller.objectFromObjectInput(GlobalMarshaller.java:199)

        at org.infinispan.marshall.core.GlobalMarshaller.objectFromByteBuffer(GlobalMarshaller.java:195)

        at org.infinispan.interceptors.impl.MarshallerConverter.unboxKey(MarshallerConverter.java:30)

        ... 155 more