Slf4j 1.7.28 doesn`t work correctly with Java 11 and gelfj-1.1.14

Before you post: Your responses to these questions will help the community help you. Please complete this template if you’re asking a support question.
Don’t forget to select tags to help index your topic!

slf4j 1.7.28 doesn`t work correctly with Java 11 and gelfj-1.1.14 when i keep gelfj-1.1.14.jar inside the payara/domain/lib folder it throws below error.

Link : slf4j 1.7.28 doesn`t work correctly with Java 11 in Connect 3.9.1 · Issue #4422 · nextgenhealthcare/connect · GitHub

Errors:
`
Transformer error

ERROR MESSAGE: Error evaluating transformer
java.lang.IllegalAccessError: class org.apache.log4j.MDCFriend tried to access field org.apache.log4j.MDC.mdc (org.apache.log4j.MDCFriend is in unnamed module of loader java.net.URLClassLoader @59d016c9; org.apache.log4j.MDC is in unnamed module of loader java.net.URLClassLoader @63440df3)
at org.apache.log4j.MDCFriend.fixForJava9(MDCFriend.java:11)
at org.slf4j.impl.Log4jMDCAdapter.(Log4jMDCAdapter.java:38)
at org.slf4j.impl.StaticMDCBinder.getMDCA(StaticMDCBinder.java:59)
at org.slf4j.MDC.bwCompatibleGetMDCAdapterFromBinder(MDC.java:99)
at org.slf4j.MDC.(MDC.java:108)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3508)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120)
at com.mirth.connect.server.util.javascript.JavaScriptTask.executeScript(JavaScriptTask.java:150)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:143)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:113)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

Transformer error
ERROR MESSAGE: Error evaluating transformer
java.lang.NoClassDefFoundError: Could not initialize class org.slf4j.MDC
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3508)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120)
at com.mirth.connect.server.util.javascript.JavaScriptTask.executeScript(JavaScriptTask.java:150)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:143)
at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.doCall(JavaScriptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScriptTask.call(JavaScriptTask.java:113)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)`

Environment : Dev/Test

  • OS Information: Windows + Linux

  • Package Version: Graylog v4.2.6+0210617

  • Service logs :

java.lang.IllegalAccessError: tried to access field org.apache.log4j.MDC.mdc from class org.apache.log4j.MDCFriend
        at org.apache.log4j.MDCFriend.fixForJava9(MDCFriend.java:11)
        at org.slf4j.impl.Log4jMDCAdapter.<clinit>(Log4jMDCAdapter.java:38)
        at org.slf4j.impl.StaticMDCBinder.getMDCA(StaticMDCBinder.java:59)
        at org.slf4j.MDC.bwCompatibleGetMDCAdapterFromBinder(MDC.java:99)
        at org.slf4j.MDC.<clinit>(MDC.java:108), 

configurations :
environment variables:

3. What steps have you already taken to try and solve the problem?
When I delivered the gelfj-1.1.14.jar along with the war file and removed it from domain/lib folder it started working. this is the temp work around but not the concrete solution as I do not want to deliver gelj-1.1.14.jar with my application wars. it was working fine with java 1.8 with payara. but I need to migrate my application from java1.8 to java11.

4. How can the community help?
If any one faced similar issue please suggest the solution.

Helpful Posting Tips: Tips for Posting Questions that Get Answers [Hold down CTRL and link on link to open tips documents in a separate tab]

Hello && Welcome

I adjusted you post to make the error logs more readable. when posting configuration files or Logs, please use the markdown, if your unsure you can look here
As for your

I’m not exactly sure what’s going on in your environment. What I do know is you have installed some other software ( i.e. slf4j 1.7.28,) that seams to not work. Could you explain in greater detail?
To be honest , I’ve never hear of that software before.

From the logs it looks like Apache and slf4j 1.7.28 do not play well with each other.

Hi GSmith,
Thanks for adjusting my post.

Actual problem is gelfj-1.1.14.jar(used to send the application specific logs to the Graylog server).
As part of java 11 migration this jar is trying to access mdc filed (having default package declaration under org.apache.log4j.MDC) and class org.apache.log4j.MDCFriend tried to access mdc field which is not public and in java 11 its not possible, as they introduced the modularization concept.

1 Like

I see, did a little research on this.

Unfortunately I’m not sure how to resolve this, but maybe someone here may be able to help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.