Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Log4J2 error when upgrading from 12.1 to 14.0d

    Hi there, we are attempting to upgrade from Smartclient 12.1 to 14.0d and we are seeing this error related to Log4J2. Any suggestions on how we can resolve? Is that null pointer below something that needs to be resolved on your side perhaps? We pulled the log4j2.isc.config.xml that came with your distro and tried to ensure any references to log4j were removed since we were only using it to support Smartclient 12.1....


    11:31:49,155 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 62) MSC000001: Failed to start service jboss.deployment.unit."rapi.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."rapi.war".undertow-deployment: java.lang.ExceptionInInitializerError
    at org.wildfly.extension.undertow@26.1....ntService.java:90)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.jboss.threads@2.4.0.Final//org.j...gRunnable.java:35)
    at org.jboss.threads@2.4.0.Final//org.j...eExecutor.java:1990)
    at org.jboss.threads@2.4.0.Final//org.j...eExecutor.java:1486)
    at org.jboss.threads@2.4.0.Final//org.j...eExecutor.java:1377)
    at java.base/java.lang.Thread.run(Thread.java:842)
    at org.jboss.threads@2.4.0.Final//org.j...ossThread.java:513)
    Caused by: java.lang.ExceptionInInitializerError
    at deployment.rapi.war//com.isomorphic.base.InitListener.oneTimeIdempotentInit(InitListener.java:95)
    at deployment.rapi.war//com.isomorphic.base.InitListener.contextInitialized(InitListener.java:91)
    at io.undertow.servlet@2.2.17.Final//io...Listeners.java:187)
    at io.undertow.servlet@2.2.17.Final//io...nagerImpl.java:219)
    at io.undertow.servlet@2.2.17.Final//io...nagerImpl.java:187)
    at io.undertow.servlet@2.2.17.Final//io...tupAction.java:42)
    at io.undertow.servlet@2.2.17.Final//io...tupAction.java:43)
    at org.wildfly.extension.undertow@26.1....foService.java:1544)
    at org.wildfly.extension.undertow@26.1....foService.java:1544)
    at org.wildfly.extension.undertow@26.1....foService.java:1544)
    at org.wildfly.extension.undertow@26.1....foService.java:1544)
    at io.undertow.servlet@2.2.17.Final//io...nagerImpl.java:255)
    at org.wildfly.extension.undertow@26.1....ntService.java:105)
    at org.wildfly.extension.undertow@26.1....ntService.java:87)
    ... 8 more
    Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.logging.log4j.core.LoggerContext.getLogger(String)" because "com.isomorphic.log.Log4j2Logger.context" is null
    at deployment.rapi.war//com.isomorphic.log.Log4j2Logger.<init>(Log4j2Logger.java:179)
    at deployment.rapi.war//com.isomorphic.log.Logger.<init>(Logger.java:313)
    at deployment.rapi.war//com.isomorphic.log.Logger.<init>(Logger.java:284)
    at deployment.rapi.war//com.isomorphic.io.ISCFile.<clinit>(ISCFile.java:92)
    ... 22 more


    #2
    This NullPointerException should not occur, even if log4j2.isc.config.xml is missing. Our logger initialization code explicitly falls back to a default configuration to ensure Log4j2Logger.context is always set. Specifically, we call LogManager.getContext(false) as a last resort — this method always returns a valid LoggerContext, even if no config file is present.

    Additionally, the logger setup is performed via static class initialization, so it’s not possible to access Logger or its internals before the context is set.

    If you're seeing context == null, it likely indicates something specific to your environment — such as classloading interference (e.g., module isolation in WildFly), or a missing or conflicting Log4j2 dependency.

    That said, the SmartClient logging system prints to the console during initialization. Do you see a message like the following in your logs (assuming log4j2.isc.config.xml is not present)?
    Code:
    === SmartClient Init: log4j2.isc.config.xml not found in CLASSPATH. Assuming log4j2 configuration for com.isomorphic is located in some other log4j2 configuration file.
    ISC: Using Log4j 2.x logging system.
    Let us know please if this helps and/or if you need more information.

    Comment


      #3
      Hi there, thanks for your response. I'm just letting you know that we've resolved our issue with log4J2. We are still working through other issues with our upgrade, but we will create other forum posts if needed to address those.

      Comment


        #4
        Originally posted by senordhuff View Post
        Hi there, thanks for your response. I'm just letting you know that we've resolved our issue with log4J2. We are still working through other issues with our upgrade, but we will create other forum posts if needed to address those.

        Hello senordhuff,

        can you tell us how you solved the problem?

        I am in the process of upgrading to 14.1 and have the same error.

        Thanks and greetings

        Comment


          #5
          Hi, it was a combination of asking ChatGPT with help on the error messages we were seeing, using the new log4j2 config available from Isomorphic in 14.x and log4j2.isc.config.xml, removing old libraries using log4J, and good old fashioned grunt work.

          Comment

          Working...
          X