You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Andrei Terentiev (Jira)" <ji...@apache.org> on 2021/08/05 00:48:00 UTC

[jira] [Closed] (LOG4J2-2844) Null pointer exception when no network interfaces are available

     [ https://issues.apache.org/jira/browse/LOG4J2-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrei Terentiev closed LOG4J2-2844.
------------------------------------

> Null pointer exception when no network interfaces are available
> ---------------------------------------------------------------
>
>                 Key: LOG4J2-2844
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2844
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.13.2
>            Reporter: Andrei Terentiev
>            Priority: Major
>             Fix For: 3.0.0, 2.14.0
>
>
> Hi,
>   java.net.NetworkInterface.getNetworkInterfaces() returns null when no network interfaces are available (e.g. networking is disabled at the moment) - see https://docs.oracle.com/javase/7/docs/api/java/net/NetworkInterface.html#getNetworkInterfaces().
> Seems that the line 98 of org.apache.logging.log4j.core.util.NetUtils.java should have a null check.
> Here is a stack trace:
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at org.apache.logging.log4j.core.util.WatchManager.<init>(WatchManager.java:53)
> at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:135)
> at org.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
> at org.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:86)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:229)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:203)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:128)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:115)
> at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:148)
> at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
> at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
> at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:602)
> at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:588)
> at App$1.<init>(App.java:36)
> Caused by: java.lang.NullPointerException
> at org.apache.logging.log4j.core.util.NetUtils.getMacAddress(NetUtils.java:98)
> at org.apache.logging.log4j.core.util.UuidUtil.<clinit>(UuidUtil.java:64)
> ... 18 more



--
This message was sent by Atlassian Jira
(v8.3.4#803005)