You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Mirko Rzehak (JIRA)" <ji...@apache.org> on 2018/07/18 19:53:00 UTC
[jira] [Created] (LOG4J2-2377) NullPointerException when using
Bootstrap classloader
Mirko Rzehak created LOG4J2-2377:
------------------------------------
Summary: NullPointerException when using Bootstrap classloader
Key: LOG4J2-2377
URL: https://issues.apache.org/jira/browse/LOG4J2-2377
Project: Log4j 2
Issue Type: Bug
Components: API
Affects Versions: 2.11.0, 2.10.0, 2.9.1
Reporter: Mirko Rzehak
When log4j2 classes are loaded via the Bootstrap classloader, creating a Logger ({{LogManager.getLogger()}}) causes a NullPointerException:
{code:java}
Exception in thread "main" java.lang.ExceptionInInitializerError
at Test.<clinit>(Test.java:6)
Caused by: java.lang.NullPointerException
at org.apache.logging.log4j.util.LoaderUtil.getClassLoaders(LoaderUtil.java:115)
at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:66)
at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:146)
at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:130)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89)
... 1 more
{code}
To reproduce this behavior I put the log4j jar files (log4j-api and log4j-core) into a dedicated directory and start my test program with {{-Djava.endorsed.dirs=dirname}}. Classes from jars in that directory are loaded using the Bootstrap classloader.
The issue came with 2.9.1. It worked with 2.9.0 and earlier versions.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)