Skip to main content
Known Participant
September 7, 2023
Question

CF encounters log4j class conflict error on application startup

  • September 7, 2023
  • 1 reply
  • 192 views

We have noticed the below error is thrown IF there is a Java object initialisation error during boot of our CF server:

 

"loader constraint violation: when resolving method  org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of coldfusion/runtime/java/JavaDynamicClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of coldfusion/bootstrap/BootstrapClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature"

Which looks as if the Java exception is trying to use log4j to log details.

The odd thing is that this Java exception clears after an application refresh and the underlying CF exception is revealed. 

We use commandbox in a 'Dev' environment so it's a war cf server deployment of an FW1/Coldspring application.

It's hardly critical, but got me wondering how CF/Java classes get loaded and precedences if conflicting class names are found, and why CF comes with both log4j AND slf4 jars in the {CF_home{/cfusion/lib folder - is there a recommended way to implement log4j 'within' CF?

    This topic has been closed for replies.

    1 reply

    Known Participant
    September 7, 2023

    Update to this: same behaviour seen on basic CF installation too - so the commandbox/war observation probably a red-herring.