Application log4j initialization fails with 'NoSuchFieldError: EMPTY_BYTE_ARRAY' on EAP 7

Solution Unverified - Updated -

Issue

  • We see the following error in application start up:
Caused by: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY
    at org.apache.logging.log4j.core.config.ConfigurationSource.<clinit>(ConfigurationSource.java:56)
    at org.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
    at org.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:85)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:140)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:230)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:664)

Environment

  • JBoss Enterprise Application Platform (EAP) 7.x
  • log4j core 2.17

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content