[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16833225#comment-16833225 ] ASF subversion and git services commented on LOG4J2-2266: - Commit 23ec2ac7a480854591c794c966edd046b5bba952 in logging-log4j2's branch refs/heads/release-2.x from Ralph Goers [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=23ec2ac ] LOG4J2-2266 - Load PropertySources from any accessible ClassLoader and handle any exceptions > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > Fix For: 2.11.2 > > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16783501#comment-16783501 ] ASF subversion and git services commented on LOG4J2-2266: - Commit ad3e48a7eb69dd2848da09d838dbb869a1d145c6 in logging-log4j2's branch refs/heads/LOG4J2-913 from Ralph Goers [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=ad3e48a ] LOG4J2-2266 - Load PropertySources from any accessible ClassLoader and handle any exceptions > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > Fix For: 2.11.2 > > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756818#comment-16756818 ] ASF subversion and git services commented on LOG4J2-2266: - Commit dfced487bdb422c56334922411e10447bdb64969 in logging-log4j2's branch refs/heads/release-2.x from Ralph Goers [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=dfced48 ] LOG4J2-2266 - Load PropertySources from any accessible ClassLoader and handle any exceptions > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756817#comment-16756817 ] ASF subversion and git services commented on LOG4J2-2266: - Commit 0eee16740007326988e2689e81e859ca03ae5bb6 in logging-log4j2's branch refs/heads/master from Ralph Goers [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=0eee167 ] LOG4J2-2266 - Load PropertySources from any accessible ClassLoader and handle any exceptions > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750043#comment-16750043 ] Pradeep Shankar commented on LOG4J2-2266: - [~ralph.go...@dslextreme.com] this continues to be a open item with JDK 8 and log4j 2.11.0. We also have a powermock which uses custom class loader to load specific classes and fails to initialize. [ERROR] Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.util.PropertiesUtil [ERROR] at org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:78) [ERROR] at org.apache.logging.log4j.LogManager.(LogManager.java:60) NOTE: tests with 2.11.1 and JDK8 also fails with the same error. We see that LOG4j2-2129 has been fixed under - [https://blogs.apache.org/logging/entry/log4j-2-11-released.] However, it does not seem to be working for jdk8 combination. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730175#comment-16730175 ] Songqq commented on LOG4J2-2266: Sorry i was too careless ,"loader" is the argument customloader (also App2ClassLoader mentioned below ). It's a little complicate. My AppServer have the Classloader hierarchy like tomcat,which children will try to load their own dependence first ,if absent parent try . The Server and AppN having their own logging config xml。So the AppN's LoggerContextFactory must be load by the AppNClassloader and initialized by reflection. ServerClassLoader / \ \ / \ \ App1ClassLoader App2ClassLoader AppN > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730087#comment-16730087 ] Ralph Goers commented on LOG4J2-2266: - What is the "loader" variable set to? > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730086#comment-16730086 ] Songqq commented on LOG4J2-2266: [~ralph.go...@dslextreme.com] I initialize the log4j2 as code below. In brief,I'am initialize the LoggerContextFactory in CustomClassloader by Reflection. The code will cause NoClassDefFoundError on version 2.11.1. {quote}{{private Object initCoreLoggerContext(ClassLoader customloader) throws Exception {}} {{ }} {{ Class logManagerClazz = loader.loadClass("org.apache.logging.log4j.LogManager");}} {{ Method getFactoryMethod = logManagerClazz.getDeclaredMethod("getFactory", (Class[]) null);}} {{ Object factory = invokeRelectMethod(getFactoryMethod, null);}} {{ }}} {quote} As I change the ContextClassLoader the Exception is gone .Everything is going to be OK. I don't konw why . {quote}{{private Object initCoreLoggerContext(ClassLoader customloader) throws Exception {}} {{ ClassLoader beforeLoader = Thread.currentThread().getContextClassLoader();}} {{ Thread.currentThread().setContextClassLoader(customloader);}} {{ Class logManagerClazz = loader.loadClass("org.apache.logging.log4j.LogManager");}} {{ Method getFactoryMethod = logManagerClazz.getDeclaredMethod("getFactory", (Class[]) null);}} {{ Object factory = invokeRelectMethod(getFactoryMethod, null);}} {{ Thread.currentThread().setContextClassLoader(beforeLoader);}} {{}}} {quote} > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16729132#comment-16729132 ] Ralph Goers commented on LOG4J2-2266: - That is OK. What does your custom Classloader do? The fix that was added specifies to use the ClassLoader of the PropertySource class. That will be the ClassLoader that logged Log4j. I suspect that that isn't good enough as the properties might be provided by a different ClassLoader. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16729116#comment-16729116 ] Songqq commented on LOG4J2-2266: [~ralph.go...@dslextreme.com] I am very sorry, I mistake type the version i used. the 2.11.1 has the Exception again,and 2.11.0 is ok. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16729031#comment-16729031 ] Ralph Goers commented on LOG4J2-2266: - [~geker] what is your environment? 2.11.2 hasn’t been released so I assume you are trying the latest code on the release-2.x branch? > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16728972#comment-16728972 ] song commented on LOG4J2-2266: -- This bug is back at the version 2.11.2. I use jdk8 with a custom Classloader to load log4j. When i use 2.8.2 and 2.11.1 ,every thing was ok,but i update to 2.11.2.the Exception occur. I don't fint the root cause , i think the bug i meet is the same as this issue {quote}{{Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.util.PropertiesUtil}} {{ at org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:78)}} {{ at org.apache.logging.log4j.LogManager.(LogManager.java:60)}} {{ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)}} {{ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)}} {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}} {quote} > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533224#comment-16533224 ] Ralph Goers commented on LOG4J2-2266: - I have created what I believe is the fix for this and committed it to branch LOG4J2-2266. Please review. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533223#comment-16533223 ] ASF subversion and git services commented on LOG4J2-2266: - Commit 2a051c2c70856863161402ccb8c1315d942e061a in logging-log4j2's branch refs/heads/LOG4J2-2266 from [~ralph.go...@dslextreme.com] [ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=2a051c2 ] LOG4J2-2266 - Use classloaders when loading properties > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16428304#comment-16428304 ] Ralph Goers commented on LOG4J2-2266: - Although the symptoms are not the same, the fix for this is the same as for LOG4J2-2152. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16382507#comment-16382507 ] Matt Sicker commented on LOG4J2-2266: - If you have Docker, you can run the Docker build to test it out. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16382482#comment-16382482 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- Sorry, I'm not yet using JDK9 to be able to compile/change code. If you could address this later - that will be appreciated. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16382077#comment-16382077 ] Matt Sicker commented on LOG4J2-2266: - The fix seems agreed upon. If you would like to submit a pull request or patch, that would be great. Otherwise, I'll take this issue later. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16381686#comment-16381686 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- Any further thoughts here? > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16375040#comment-16375040 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- See this interesting discussion about ServiceLoader usage and folks reporting such approach limitations: https://stackoverflow.com/questions/7039467/java-serviceloader-with-multiple-classloaders > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16374962#comment-16374962 ] Ralph Goers commented on LOG4J2-2266: - If that is how you want to solve it I have no problem with that. Note that ServiceLoader's load(someClass) method should never be used, only the method that accepts a ClassLoader. Also, fixing the service loader part won't fix the OSGi portion of the issue. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16374851#comment-16374851 ] Matt Sicker commented on LOG4J2-2266: - If we need to go through the trouble of finding a ClassLoader for ServiceLoader, then we ought to make a wrapper class around ServiceLoader because that makes it nearly useless. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16374133#comment-16374133 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- Matt - I've double-checked and used also verbose class loading and could confirm that there are no duplicate log4j-api jars in my classpath. And that PropertiesUtil/StatusLogger/LogManager are all loaded from same jar. I think Ralph has summarized quite well what could be root cause in this case and that some similar previous fix is needed here. If you could provide some patch to try - I could try that. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373957#comment-16373957 ] Ralph Goers commented on LOG4J2-2266: - Matt, PropertiesUtil was modified to use ServiceLoader.load without specifying a ClassLoader. That is problematic for OSGi users. See http://blog.osgi.org/2013/02/javautilserviceloader-in-osgi.html for an explanation. When I implemented the Provider binding for LogManager I took this into account. In addition, it is possible that the implementation might not be found int the same ClassLoader as the caller. To handle this I tried to find all the ClassLoaders I could and loop through them. The mistake I made that is referenced in LOG4J2-2055 is that I end up looking at the same ClassLoader twice. That shouldn't be a big deal but it isn't correct and needs to be fixed. Please take a look at ProviderUtil for how it deals with the ClassLoader. You will have to look at the Activator class in Log4j-API to see how it deals with Providers. You will need to do something similar for PropertySource to work properly in OSGi. I used the link above to guide me in getting the Provider to work with OSGi. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373804#comment-16373804 ] Matt Sicker commented on LOG4J2-2266: - Do you have any duplicate log4j-api jars on your classpath? As for your environment, are you using JUnit, TestNG, or something else? And how do you run the tests? (i.e., via command line, or the IDE, or something else) As for why ServiceLoader is used here, it's to allow extensions by containers/etc. to add in more global property sources (e.g., etcd config lookup). > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373458#comment-16373458 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- I could see that new introduced difference in v2.10.0 comparing to v2.9.1 is presence of META-INF/services/org.apache.logging.log4j.util.PropertySource entry within log4j-api-2.10.0.jar with content of: org.apache.logging.log4j.util.EnvironmentPropertySource org.apache.logging.log4j.util.SystemPropertiesPropertySource and so that potentially explains this new phenomena of ServiceConfigurationError. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373411#comment-16373411 ] Ralph Goers commented on LOG4J2-2266: - The code in question here has nothing to do with Java 9 support. Matt implemented it for LOG4J2-1431. I suspect it needs the same fix I implemented for LOG4J2-2055 to go through all the class loaders. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373396#comment-16373396 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- I'm trying to minimize some code and did now directly such in my test class within static {} clause to mimic what Log4j2 was trying to do: try { PropertiesUtil PROPS = new PropertiesUtil("log4j2.StatusLogger.properties"); } catch (Throwable e) { e.printStackTrace(); } and got upper stack as reported for this bug, but actual root cause like such: java.util.ServiceConfigurationError: org.apache.logging.log4j.util.PropertySource: Provider org.apache.logging.log4j.util.EnvironmentPropertySource not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at org.apache.logging.log4j.util.PropertiesUtil$Environment.(PropertiesUtil.java:319) at org.apache.logging.log4j.util.PropertiesUtil$Environment.(PropertiesUtil.java:310) at org.apache.logging.log4j.util.PropertiesUtil.(PropertiesUtil.java:69) at org.apache.logging.log4j.util.PropertiesUtil.(PropertiesUtil.java:49) ... and that brings me back to where I've started looking into similar issues initially for v2.9.1, i.e. LOG4J2-2055. I cannot provide test project out of my complex code, but I think issue now should be more or less clear. And line 375 inside ServiceLoader class for JDK8 is: if (!service.isAssignableFrom(c)) { fail(service, "Provider " + cn + " not a subtype"); } So if Log4j2 v2.10.0 is supposed to still work with JDK8 as before - we need to fix this obviously. if you may have some patch to try in form of jar with compiled classes - I could do that, cause not yet using JDK9 to build things myself. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373009#comment-16373009 ] Ralph Goers commented on LOG4J2-2266: - Can you attach a test project I could use to look into the error? > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372977#comment-16372977 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- Ralph - previously we were discussing ServiceLoader logic introduced for purposes of JDK9 side effects under this bug: LOG4J2-2104, which is still open. According to PowerMock documentation [http://powermock.github.io/:] "PowerMock uses a custom classloader..." and current Log4j2 performed changes around ServiceLoader closely related to classloading resolution. So my thinking here is that new logic breaks in some way visibility of classes within classloaders hierarchy. If I could put some debug switch while getting this error to generate more logs for troubleshooting - please let me know which to set andI'll collect those. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372880#comment-16372880 ] Ralph Goers commented on LOG4J2-2266: - I don't see how the error you are getting could be in any way related to the Java 9 support. Log4j API does not require Java 9 to run and PropertiesUtil is included as part of the Log4j API jar and is compiled with the Java 7 compiler so I am a bit puzzled as to how you could be getting a NoClassDefFoundError. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372582#comment-16372582 ] Andrejus Chaliapinas commented on LOG4J2-2266: -- Sorry for my unlear point about unit tests - those are mine for my project, using JUnit+Powermock combination. When Log4j2 v2.8.2 is in classpath - they work. When Log4j2 v2.10.0 - some of them fail with above error. I didn't yet attempt to build master branch with JDK9 as according to Matt I could do rebuild with only JDK9 if I'd like to add some extra debugging/etc. to understand issue better myself. Curently I'm just using JDK8. That's why my proposal is to introduce JDK8 compatibility setting, which will allow logic around ServiceLoader to work the way it was for v2.8.2 and leave JDK9 specifics aside and for those who really needs that/tries that. Does it make sense for you? > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LOG4J2-2266) Log4j2 throws NoClassDefFoundError in Java 8
[ https://issues.apache.org/jira/browse/LOG4J2-2266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372179#comment-16372179 ] Ralph Goers commented on LOG4J2-2266: - I'm unclear what you are doing - unit tests of what? All the Log4j 2 unit tests pass when building with Java 8 - I do it all the time. > Log4j2 throws NoClassDefFoundError in Java 8 > > > Key: LOG4J2-2266 > URL: https://issues.apache.org/jira/browse/LOG4J2-2266 > Project: Log4j 2 > Issue Type: Bug >Affects Versions: 2.10.0 >Reporter: Andrejus Chaliapinas >Priority: Major > > During Unit Tests run using JDK 8 and Log4j2 v2.10.0 - getting this as part > of exception stack: > > java.lang.NoClassDefFoundError: Could not initialize class > org.apache.logging.log4j.util.PropertiesUtil > at > org.apache.logging.log4j.status.StatusLogger.(StatusLogger.java:71) > at org.apache.logging.log4j.LogManager.(LogManager.java:60) > > and issue seems to be somehow related to what is reported so far against JDK > 9 here: LOG4J2-2129. > > If some patch on top of v2.10.0 is available to test - please let me know > where to download it from. > > While running same UTs with same JDK 8 and v2.8.2 - issue is not observed. > > And question which I have here - why not introduce JDK8 compatibility runtime > mode while things with JDK9 are not yet that stable? So it could continue use > same logic as of v2.8.2 around that ServiceLoader and not cause side effects. -- This message was sent by Atlassian JIRA (v7.6.3#76005)