Error: “The LogManager accessed before the ‘java.util.logging.manager’ system property was set” in Spring Boot 3.3 WAR deployed on JBoss EAP 8.0

Error: “The LogManager accessed before the ‘java.util.logging.manager’ system property was set” in Spring Boot 3.3 WAR deployed on JBoss EAP 8.0

The error message “The LogManager accessed before the ‘java.util.logging.manager’ system property was set” usually appears in Java applications that are running on JBoss EAP when the logging framework is not set up correctly. This is very important when running a Spring Boot application on JBoss EAP 8.0 as a WAR file.

Potential Solutions

You can take the following actions to fix this problem:

1. Configure the system property java.util.logging.manager:

To utilise the JBoss log manager, you must explicitly set the java.util.logging.manager system attribute. You may accomplish this by include the subsequent line in your JBoss starting configuration:

-Djava.util.logging.manager=org.jboss.logmanager.LogManager

You can add this to your JAVA_OPTS in the JBoss startup script (e.g., standalone.conf or domain.conf):

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

2. Verify JBoss Configuration:

Ensure that your JBoss configuration files are correctly set up to use the JBoss log manager. This includes checking the standalone.xml or domain.xml files for any logging configurations that may conflict with the JBoss logging system.

3. Check for Deprecated Options:

If you previously used the -logmodule option, be aware that it is deprecated. Instead, rely solely on the java.util.logging.manager property as mentioned above. Remove any deprecated configurations to avoid conflicts.

4. Review Application Dependencies:

Ensure that your Spring Boot application does not include conflicting logging libraries. If you’re using Spring Boot’s default logging (Logback), ensure that it is compatible with JBoss logging. You may need to exclude certain logging dependencies in your pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-logging</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
    </exclusions>
</dependency>

5. Test with a Clean Deployment:

Sometimes, stale configurations or cached files can cause issues. Ensure that you clean your deployment directory and redeploy your application. This can help eliminate any residual configurations that might be causing the problem.

Example Configuration

Here’s how your startup script might look after the changes:

# In standalone.conf or domain.conf
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

Conclusion

By setting the java.util.logging.manager system property correctly and ensuring your application and server configurations are in sync, you should be able to resolve the error. If the issue persists, consider checking the JBoss EAP logs for any additional error messages that could provide further insight into the problem.

Citations:
[1] https://stackoverflow.com/questions/21134303/logmanager-exception-in-jboss-as-7-1-with-java-util-logger
[2] https://github.com/quarkusio/quarkus/issues/36976
[3] https://knowledge.broadcom.com/external/article/249542/jboss-logging-error.html
[4] https://docs.redhat.com/en/documentation/red_hat_jboss_enterprise_application_platform/8.0/html-single/release_notes_for_red_hat_jboss_enterprise_application_platform_8.0/index
[5] https://dzone.com/articles/deploying-spring-boot-app-to-jboss-wildfly
[6] https://access.redhat.com/articles/6961381
[7] https://groups.google.com/g/wildfly/c/2nhdkQ9ocKg
[8] https://groups.google.com/g/wildfly/c/Rc-MYPWgQIs

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *