We have a similar issue than https://github.com/ehcache/ehcache3/issues/3220 with an application under JBoss EAP 8.0.0.GA running with java 17. On the REST get call we use caching feature with ehcache-3.10.8-jakarta.jar and it throws the following error (log server error) :
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.concurrent.ThreadLocalRandomUtil.getSMU(ThreadLocalRandomUtil.java:52)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.concurrent.ThreadLocalRandomUtil.<clinit>(ThreadLocalRandomUtil.java:37)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.concurrent.ConcurrentHashMap$TreeBin.<clinit>(ConcurrentHashMap.java:3316)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.concurrent.ConcurrentHashMap.<clinit>(ConcurrentHashMap.java:283)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.SimpleBackend.<init>(SimpleBackend.java:38)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.OnHeapStore.lambda$new$4(OnHeapStore.java:229)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.OnHeapStore.<init>(OnHeapStore.java:233)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.OnHeapStore$Provider.createStoreInternal(OnHeapStore.java:1668)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.OnHeapStore$Provider.createStore(OnHeapStore.java:1647)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.impl.internal.store.heap.OnHeapStore$Provider.createStore(OnHeapStore.java:1620)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.core.EhcacheManager.getStore(EhcacheManager.java:507)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.core.EhcacheManager.createNewEhcache(EhcacheManager.java:346)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.core.EhcacheManager.createCache(EhcacheManager.java:274)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.core.EhcacheManager.createCache(EhcacheManager.java:252)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//org.ehcache.jsr107.Eh107CacheManager.createCache(Eh107CacheManager.java:180)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.commons.cache.AbstractMultiCacheAccessor.getCacheOrCreate(AbstractMultiCacheAccessor.java:61)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.commons.cache.AbstractMultiCacheAccessor.getValue(AbstractMultiCacheAccessor.java:82)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.commons.nrest.util.RestCache.computeIfAbsent(RestCache.java:296)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.commons.nrest.util.RestCache.computeIfAbsent(RestCache.java:268)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.commons.nrest.rules.SBFRuleReader.findEndPointRule(SBFRuleReader.java:136)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.api.AbstractRestApi.findRule(AbstractRestApi.java:309)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.security.SBFBusinessValidatorDefault.isValid(SBFBusinessValidatorDefault.java:205)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.util.BusinessContextUtility.lambda$verifyAndSetServiceContext$2(BusinessContextUtility.java:364)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.util.BusinessContextUtility.proceedForValidation(BusinessContextUtility.java:425)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.util.BusinessContextUtility.verifyAndSetServiceContext(BusinessContextUtility.java:364)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.util.BusinessContextUtility.verifyAndSetServiceContext(BusinessContextUtility.java:311)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.util.BusinessContextUtility$Proxy$_$$_WeldClientProxy.verifyAndSetServiceContext(Unknown Source)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear.myapplication-rest-jaxrs-6.0.0-SNAPSHOT-jboss7.war//com.myapplication.banking.myapplication.rest.api.v1.admin.NotificationApi.listNotification(NotificationApi.java:37)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:222)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.resteasy-core@6.2.4.Final-redhat-00001//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at jakarta.servlet.api@6.0.0.redhat-00001//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:204)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:239)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.nrest.filter.RestWebFilter.doFilter(RestWebFilter.java:64)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.security.filter.AbstractSecurityFilter.filter(AbstractSecurityFilter.java:533)
at deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear//com.myapplication.framework.security.filter.AbstractSecurityFilter.doFilter(AbstractSecurityFilter.java:461)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.security.elytron-web.undertow-server@4.0.0.Final-redhat-00001//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest$1(ElytronRunAsHandler.java:68)
at org.wildfly.security.elytron-base@2.2.2.Final-redhat-00001//org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
at org.wildfly.security.elytron-base@2.2.2.Final-redhat-00001//org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
at org.wildfly.security.elytron-base@2.2.2.Final-redhat-00001//org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
at org.wildfly.security.elytron-web.undertow-server@4.0.0.Final-redhat-00001//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at org.wildfly.security.elytron-web.undertow-server-servlet@4.0.0.Final-redhat-00001//org.wildfly.elytron.web.undertow.server.servlet.CleanUpHandler.handleRequest(CleanUpHandler.java:38)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
at org.wildfly.extension.undertow@8.0.0.GA-redhat-00011//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1430)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.core@2.3.10.SP3-redhat-00001//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1348)
at org.jboss.xnio@3.8.12.SP2-redhat-00001//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe from [Module "deployment.myapplication-ear-6.0.0-SNAPSHOT-jboss7.ear" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 108 more
Maybe addition of module-info file in the ehcache jar can resolve the issue under WildFly/JBoss EAP runtimes, see
After some investigation we have found that Redhat has removed the following code on Jboss EAP startup scripts:
call :setModularJdk
if "!MODULAR_JDK!" == "true" (
echo "%~1" | findstr /I "\-\-add\-modules" > nul
if errorlevel == 1 (
rem Set default modular jdk options
set "DEFAULT_MODULAR_JVM_OPTIONS=!DEFAULT_MODULAR_JVM_OPTIONS! --add-exports=java.base/sun.nio.ch=ALL-UNNAMED"
set "DEFAULT_MODULAR_JVM_OPTIONS=!DEFAULT_MODULAR_JVM_OPTIONS! --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED"
set "DEFAULT_MODULAR_JVM_OPTIONS=!DEFAULT_MODULAR_JVM_OPTIONS! --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED"
) else (
set "DEFAULT_MODULAR_JVM_OPTIONS="
)
)
goto:eof
Addition of the following code can resolve this issue on Jboss EAP 8.0.0. However it's a short term workaround because more and more libraries include module-info file now. And we need to apply this workaround on other runtimes such as: Wilfly, OpenLiberty, etc.
Hello,
We have a similar issue than https://github.com/ehcache/ehcache3/issues/3220 with an application under JBoss EAP 8.0.0.GA running with java 17. On the REST get call we use caching feature with ehcache-3.10.8-jakarta.jar and it throws the following error (log server error) :
Maybe addition of module-info file in the ehcache jar can resolve the issue under WildFly/JBoss EAP runtimes, see
After some investigation we have found that Redhat has removed the following code on Jboss EAP startup scripts:
Addition of the following code can resolve this issue on Jboss EAP 8.0.0. However it's a short term workaround because more and more libraries include module-info file now. And we need to apply this workaround on other runtimes such as: Wilfly, OpenLiberty, etc.
Regards.
Originally posted by @ludade in https://github.com/ehcache/ehcache3/issues/3220#issuecomment-2047962066