Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wildfly 16, log4j 2.17.0, NoSuchFieldError: EMPTY_BYTE_ARRAY

Tags:

log4j

wildfly

I get an error during wildfly startup with the following message:

NoSuchFieldError: EMPTY_BYTE_ARRAY

The message also say that this error occurs in undertow deployment. Could anybody give me a hint of what is going on here and how to solve that?

Below is the beginning of the stack trace.

at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:90)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:829)
at [email protected]//org.jboss.threads.JBossThread.run(JBossThread.java:513)

Caused by: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY at deployment.taggable-server.war//org.apache.logging.log4j.core.config.ConfigurationSource.(ConfigurationSource.java:56) at deployment.taggable-server.war//org.apache.logging.log4j.core.config.NullConfiguration.(NullConfiguration.java:32) at deployment.taggable-server.war//org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:85) at deployment.taggable-server.war//org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254) at deployment.taggable-server.war//org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218) at deployment.taggable-server.war//org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136) at deployment.taggable-server.war//org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123) at deployment.taggable-server.war//org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117) at deployment.taggable-server.war//org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150) at deployment.taggable-server.war//org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47) at [email protected]//org.apache.logging.log4j.LogManager.getContext(LogManager.java:196) at [email protected]//org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)

like image 599
r-uu Avatar asked Apr 16 '26 04:04

r-uu


1 Answers

I had the same problem, you can solve it like this:

  1. For a war:

    with a jboss-deployment-structure.xml inside src/main/webapp/WEB-INF/ like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
      <deployment>
         <exclusions>
            <module name="org.apache.logging.log4j.api"/>
        </exclusions>
      </deployment>
    </jboss-deployment-structure>
    
  2. For an ear:

    with a jboss-deployment-structure.xml inside src/main/application/META-INF/ like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
      <sub-deployment name="mywar.war">
         <exclusions>
            <module name="org.apache.logging.log4j.api"/>
        </exclusions>
      </sub-deployment>
    </jboss-deployment-structure>
    
like image 70
madx Avatar answered Apr 21 '26 06:04

madx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!