ClassCircularityError: java / util / logging / LogRecord works Gradle webapp with JavaMelody and Tomcat plugin

I get a stack trace below when I try to run my application using the Tomdle Gradle plugin in-box container.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':tomcatRun'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
...
Caused by: java.lang.ClassCircularityError: java/util/logging/LogRecord
    at net.bull.javamelody.LoggingHandler.publish(LoggingHandler.java:109)
    at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)
    at org.apache.juli.logging.DirectJDKLog.debug(DirectJDKLog.java:106)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:369)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341)
    at org.apache.catalina.startup.Tomcat$start.call(Unknown Source)
    at org.gradle.api.plugins.tomcat.embedded.BaseTomcatServerImpl.start(BaseTomcatServerImpl.groovy:37)
...

This does not happen when I use external Tomcat, so I expect it to have something to do with the Gradle classpath and Gradle built-in dependencies (and I don’t even know how to find out what it is). I worked a little and people seem to have similar problems related to SLF4J and / or Logback, none of which are used by my project. I tried to get around this with obsolete bridges SLF4J , but to no avail - probably because I declare them in my own build.gradleand at that moment it is too late (Gradle itself has already pulled / configured SLF4J).

, JULI Tomcat log to log4j , , , JAR $CATALINA_HOME/bin $CATALINA_HOME/lib, , Gradle.

?

+4
1

, Tomcat java.util.logging Log4J.

build.gradle:

  tomcat "org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}"
  // tomcat "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
+3

Source: https://habr.com/ru/post/1542708/


All Articles