0

We've modified the code compatible to OpenJDK 11. When we try deploying the application via Tomcat, below error is encountered:

Caused by: java.lang.IllegalAccessError: class org.slf4j.LoggerFactory tried to access private field org.slf4j.impl.StaticLoggerBinder.SINGLETON (org.slf4j.LoggerFactory and org.slf4j.impl.StaticLoggerBinder are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @61526469)
                at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
                at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addStatus(StatusViaSLF4JLoggerFactory.java:32)
                at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addInfo(StatusViaSLF4JLoggerFactory.java:20)
                at ch.qos.logback.classic.servlet.LogbackServletContainerInitializer.onStartup(LogbackServletContainerInitializer.java:32)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                ... 38 more

Dependencies in pom.xml:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.6</version>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.6</version>
</dependency>

With OpenJDK 8, it was working fine.

Tomcat version: apache-tomcat-9.0.27

  • Are you using Hibernate? Use `maven:dependency tree` to see if you have an older version of slf4j on your classpath. See: http://www.slf4j.org/faq.html#IllegalAccessError – marstran Jan 28 '20 at 11:25
  • we are not using hibernate. I have cross checked all SLF4j in dependency tree and excluded in all other areas.in-Built dependecies. Now having only one SLF4j which i have added newly. There are no other conflicts with classpath. I doubt about tomcat internal ch.qos.logback dependency. How to eliminate it ? – Aravind Rajendran Jan 28 '20 at 11:33
  • I have removed all slf4j jar dependecies from my application .. Eventhough the error is same . org.slf4j.impl.StaticLoggerBinder are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader – Aravind Rajendran Jan 28 '20 at 11:39

0 Answers0