[slf4j-dev] [JIRA] (SLF4J-438) IllegalAccessError in MDC when using Java 10
QOS.CH (JIRA)
noreply-jira at qos.ch
Tue Jul 3 09:40:00 CEST 2018
[ https://jira.qos.ch/browse/SLF4J-438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19199#comment-19199 ]
Andreas Bergander commented on SLF4J-438:
-----------------------------------------
I noticed that there are some fixes for this issue in the 1.8.0 branch but I still get this error:
{noformat}
java.lang.IllegalAccessException: class org.apache.log4j.MDCFriend cannot access a member of class org.apache.log4j.MDC with modifiers "static final"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:360)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:589)
at java.base/java.lang.reflect.Field.checkAccess(Field.java:1075)
at java.base/java.lang.reflect.Field.get(Field.java:416)
at org.apache.log4j.MDCFriend.fixForJava9(MDCFriend.java:15)
at org.slf4j.log4j12.Log4jMDCAdapter.<clinit>(Log4jMDCAdapter.java:38)
at org.slf4j.impl.StaticMDCBinder.getMDCA(StaticMDCBinder.java:60)
at org.slf4j.MDC.bwCompatibleGetMDCAdapterFromBinder(MDC.java:99)
at org.slf4j.MDC.<clinit>(MDC.java:108)
{noformat}
> IllegalAccessError in MDC when using Java 10
> --------------------------------------------
>
> Key: SLF4J-438
> URL: https://jira.qos.ch/browse/SLF4J-438
> Project: SLF4J
> Issue Type: Bug
> Affects Versions: 1.7.25, 1.8.0-beta2
> Environment: Java 10
> slf4j-api-1.7.25
> slf4j-log4j12-1.7.25
> Reporter: Andreas Bergander
> Assignee: SLF4J developers list
>
> When using MDC and log4j I get an IllegalAccessError during initialization.
> {noformat}
> java.lang.IllegalAccessError: tried to access field org.apache.log4j.MDC.mdc from class org.apache.log4j.MDCFriend
> at org.apache.log4j.MDCFriend.fixForJava9(MDCFriend.java:11)
> at org.slf4j.impl.Log4jMDCAdapter.<clinit>(Log4jMDCAdapter.java:38)
> at org.slf4j.impl.StaticMDCBinder.getMDCA(StaticMDCBinder.java:59)
> at org.slf4j.MDC.bwCompatibleGetMDCAdapterFromBinder(MDC.java:99)
> at org.slf4j.MDC.<clinit>(MDC.java:108)
> {noformat}
> I guess package private fields are not accessible between different jar-files anymore in Java 10. Or am I doing something wrong?
>
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the slf4j-dev
mailing list