Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to instantiate [ch.qos.logback.classic.LoggerContext] in multi-module build with logback #12296

Closed
mtgleeson opened this issue Dec 28, 2021 · 1 comment

Comments

@mtgleeson
Copy link

Expected Behavior

I have upgraded from Grails 4 to Grail 5.1.1. I have a multi module project using logback.
Running 'gradle compileTestGroovy' should run successfully without error.

Looks to be the same as #11476. That issue was closed and I couldn't see how to re-open it so I've created a new issue.

Actual Behaviour

I get the following exception from running 'gradle compileTestGroovy':

`> Task :common:compileTestGroovy
Execution optimizations have been disabled for task ':common:compileTestGroovy' to ensure correctness due to the following reasons:

  • Gradle detected a problem with the following location: '/xxx/build/gson-classes/main'. Reason: Task ':common:compileTestGroovy' uses this output of task ':common:compileGsonViews' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
    Failed to instantiate [ch.qos.logback.classic.LoggerContext]
    Reported exception:
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    Script1.groovy: 1: unable to resolve class grails.util.BuildSettings
    @ line 1, column 1.
    import grails.util.BuildSettings
    ^

Script1.groovy: 2: unable to resolve class grails.util.Environment
@ line 2, column 1.
import grails.util.Environment
^

Script1.groovy: 3: unable to resolve class org.springframework.boot.logging.logback.ColorConverter
@ line 3, column 1.
import org.springframework.boot.logging.logback.ColorConverter
^

Script1.groovy: 4: unable to resolve class org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter
@ line 4, column 1.
import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter
^

Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.encoder.PatternLayoutEncoder
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
13 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:295)
at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:914)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
at groovy.lang.GroovyShell.parse(GroovyShell.java:570)
at groovy.lang.GroovyShell.parse(GroovyShell.java:565)
at groovy.lang.GroovyShell$parse.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:71)
at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:44)
at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:43)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:67)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
at io.micronaut.core.io.service.SoftServiceLoader.<clinit>(SoftServiceLoader.java:65)
at io.micronaut.ast.groovy.TypeElementVisitorStart.visit(TypeElementVisitorStart.groovy:61)
at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$addPhaseOperationsForGlobalTransforms$4(ASTTransformationVisitor.java:337)
at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:901)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:610)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:262)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:64)
at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:97)
at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:76)
at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
at java.lang.Thread.run(Thread.java:745)

SLF4J: A number (5) of logging calls during the initialization phase have been intercepted and are
SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#replay
`

Steps To Reproduce

@longwa previously created a project to reproduce this - https://github.com/longwa/logbackError

Environment Information

Macbook Pro

% grails -version
| Grails Version: 5.1.1
| JVM Version: 1.8.0_275

Example Application

https://github.com/longwa/logbackError

Version

5.1.1

@puneetbehl
Copy link
Contributor

Duplicate #12291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants