[ https://issues.apache.org/jira/browse/SLING-10831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17492554#comment-17492554 ]
Robert Munteanu commented on SLING-10831: ----------------------------------------- I think that for now we are safe with {{--add-opens}} and the current Java versions. I am not sure whether the option will actually go away at some point. ISTR that [~kpauls] said at some point that if we were to run on the module path via OSGi Connect/Felix Atomos this kind of problem would be solved. But I might be wrong as I don't know all that much about the problem. > o.a.s.commons.thread fails setting up ThreadLocal cleaner on Java 17 > -------------------------------------------------------------------- > > Key: SLING-10831 > URL: https://issues.apache.org/jira/browse/SLING-10831 > Project: Sling > Issue Type: Bug > Components: Commons > Reporter: Robert Munteanu > Priority: Major > Fix For: Commons Threads 3.3.0 > > > When running the Sling Starter with Java 17, the following messages come up: > {noformat}21.09.2021 11:13:54.247 *WARN* [sling-default-1] > org.apache.sling.commons.threads.impl.ThreadPoolExecutorCleaningThreadLocals > Could not set up thread local cleaner (most probably not a compliant JRE): {} > java.lang.ExceptionInInitializerError: null > at > org.apache.sling.commons.threads.impl.ThreadPoolExecutorCleaningThreadLocals.beforeExecute(ThreadPoolExecutorCleaningThreadLocals.java:58) > [org.apache.sling.commons.threads:3.2.20] > at > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) > at > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) > at java.base/java.lang.Thread.run(Thread.java:833) > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > field java.lang.ThreadLocal$ThreadLocalMap java.lang.Thread.threadLocals > accessible: module java.base does not "opens java.lang" to unnamed module > @6e04bc96 > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) > at > java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) > at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) > at > org.apache.sling.commons.threads.impl.ThreadLocalCleaner.field(ThreadLocalCleaner.java:77) > [org.apache.sling.commons.threads:3.2.20] > at > org.apache.sling.commons.threads.impl.ThreadLocalCleaner.<clinit>(ThreadLocalCleaner.java:54) > [org.apache.sling.commons.threads:3.2.20] > ... 4 common frames omitted > 21.09.2021 11:13:54.248 *ERROR* [sling-default-1] > org.apache.sling.extensions.threaddump.internal.Activator Uncaught exception > in Thread Thread[sling-default-1,5,main] > java.lang.ExceptionInInitializerError: null > at > org.apache.sling.commons.threads.impl.ThreadPoolExecutorCleaningThreadLocals.beforeExecute(ThreadPoolExecutorCleaningThreadLocals.java:58) > [org.apache.sling.commons.threads:3.2.20] > at > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) > at > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) > at java.base/java.lang.Thread.run(Thread.java:833) > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > field java.lang.ThreadLocal$ThreadLocalMap java.lang.Thread.threadLocals > accessible: module java.base does not "opens java.lang" to unnamed module > @6e04bc96 > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) > at > java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) > at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) > at > org.apache.sling.commons.threads.impl.ThreadLocalCleaner.field(ThreadLocalCleaner.java:77) > [org.apache.sling.commons.threads:3.2.20] > at > org.apache.sling.commons.threads.impl.ThreadLocalCleaner.<clinit>(ThreadLocalCleaner.java:54) > [org.apache.sling.commons.threads:3.2.20] > ... 4 common frames omitted > {noformat} -- This message was sent by Atlassian Jira (v8.20.1#820001)