[ https://issues.apache.org/jira/browse/LOG4J2-1637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15634666#comment-15634666 ]
Remko Popma commented on LOG4J2-1637: ------------------------------------- The LOG4J2-1660 changes are a good thing regardless of the OSGi issue. I wish I had thought of introducing ReadOnlyThreadContextMap sooner when working on LOG4J2-1349. I was never happy with the package-protected method in ThreadContext which then needed to be made public again in the ThreadContextAccessor class for the ContextInjectors. The new solution is much cleaner. About the unit test: are we sure it is testing the right thing then? There may actually be two problems: # [~lhochet] mentioned "Log4j2 2.7 fails to initialise in an OSGi environement complaining that java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger" (no stack trace, so I am not sure if the underlying issue is impacted by my fix...) # [~pbelbin] mentioned "Severe: Error invoking ServletContainerInitializer org.apache.logging.log4j.web.Log4jServletContainerInitializer java.lang.IllegalAccessError: tried to access method org.apache.logging.log4j.ThreadContext.getThreadContextMap()Lorg/apache/logging/log4j/spi/ThreadContextMap; from class org.apache.logging.log4j.ThreadContextAccess" This last issue should be addressed by the LOG4J2-1660 fix. Peter, and Ludovic, can you both check if the issue still occurs with the latest code in master? > OSGi support is broken in Log4j2 2.7 > ------------------------------------ > > Key: LOG4J2-1637 > URL: https://issues.apache.org/jira/browse/LOG4J2-1637 > Project: Log4j 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.7 > Environment: Apache Felix, Java 8 > Reporter: Ludovic HOCHET > Attachments: patch-log4j2-1637.diff > > > Log4j2 2.7 fails to initialise in an OSGi environement complaining that > java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger. > Running the OSGi tests on Log4j API also fails: > org.apache.logging.log4j.osgi.felix.FelixLoadApiBundleTest > testMissingImportOfCoreOsgiPackage(org.apache.logging.log4j.osgi.felix.FelixLoadApiBundleTest) > Time elapsed: 1.031 sec <<< ERROR! > org.osgi.framework.BundleException: Activator start error in bundle > org.apache.logging.log4j.core [2]. > Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger > Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger > not found by org.apache.logging.log4j.core [2] > [... likewise for the other tests and equinox] -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org