You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We always run our application with JDK21 and -Dsun.reflect.debugModuleAccessChecks=true to check for possible issues resulting from module boundary issues.
After recently upgrading logback, we started seeing this exception being logged:
java.lang.IllegalAccessException: class ch.qos.logback.core.util.ExecutorServiceUtil$1 cannot access a member of class java.lang.ThreadBuilders$VirtualThreadBuilder (in module java.base) with modifiers "public"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:394)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:714)
at java.base/java.lang.reflect.Method.invoke(Method.java:571)
at ch.qos.logback.core.util.ExecutorServiceUtil$1.makeThreadFactory(ExecutorServiceUtil.java:58)
at ch.qos.logback.core.util.ExecutorServiceUtil$1.<init>(ExecutorServiceUtil.java:45)
at ch.qos.logback.core.util.ExecutorServiceUtil.<clinit>(ExecutorServiceUtil.java:40)
at ch.qos.logback.core.ContextBase.stopExecutorServices(ContextBase.java:247)
at ch.qos.logback.core.ContextBase.stop(ContextBase.java:172)
at ch.qos.logback.classic.LoggerContext.stop(LoggerContext.java:346)
[...snip...]
Now, while the class ExecutorServiceUtil catches that exception and handles it, it also points to an underlying issue: the getMethod(FACTORY_METHOD_NAME) is performed on the wrong (concrete) class java.lang.ThreadBuilders.VirtualThreadBuilder, instead of the public interface java.lang.Thread.Builder.
As such, I can't see any way the current code would work as is.
I hope to provide a PR to fix this shortly.
The text was updated successfully, but these errors were encountered:
jpmsilva
added a commit
to jpmsilva/logback
that referenced
this issue
Feb 5, 2024
Apologies for the spam in advance.
I just wanted to confirm that the fix does indeed work, and we no longer observe the illegal access exception when starting the application with version 1.5.
I also wanted to leave a word of thanks for the wonderful libraries that you provide to the community, and the amazing support and maintenance to them. I really enjoyed learning from the multijar release commit you provided, as I had never seen it actually done in a project.
Thank you!
We always run our application with JDK21 and
-Dsun.reflect.debugModuleAccessChecks=true
to check for possible issues resulting from module boundary issues.After recently upgrading logback, we started seeing this exception being logged:
Now, while the class
ExecutorServiceUtil
catches that exception and handles it, it also points to an underlying issue: thegetMethod(FACTORY_METHOD_NAME)
is performed on the wrong (concrete) classjava.lang.ThreadBuilders.VirtualThreadBuilder
, instead of the public interfacejava.lang.Thread.Builder
.As such, I can't see any way the current code would work as is.
I hope to provide a PR to fix this shortly.
The text was updated successfully, but these errors were encountered: