• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF encounters log4j class conflict error on application startup

Explorer ,
Sep 07, 2023 Sep 07, 2023

Copy link to clipboard

Copied

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?

Views

84

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 07, 2023 Sep 07, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation