micronaut-projects / micronaut-aot

Experimental Ahead-of-time optimizations for Micronaut
Apache License 2.0
17 stars 5 forks source link

log4j2 - ran into issues with mn #321

Open sdelamo opened 2 weeks ago

sdelamo commented 2 weeks ago

Discussed in https://github.com/micronaut-projects/micronaut-core/discussions/11082

Originally posted by **waveskimmer** August 13, 2024 Using `mn create-app demo -b=gradle_kotlin --jdk=21 --lang=kotlin --features=yaml,log4j2` I'm getting this error: ``` > Task :prepareJitOptimizations FAILED SLF4J(W): No SLF4J providers were found. SLF4J(W): Defaulting to no-operation (NOP) logger implementation SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details. SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier. SLF4J(W): Ignoring binding found at [jar:file:/Users/A618887/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-slf4j-impl/2.23.1/9ef67909a1b4eae999af4c7a211ab2379e4b86c2/log4j-slf4j-impl-2.23.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation. java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at io.micronaut.aot.cli.Main.executeInIsolatedLoader(Main.java:113) at io.micronaut.aot.cli.Main.run(Main.java:87) ``` Any ideas?
sdelamo commented 6 days ago

@melix can you check this:

> Task :prepareJitOptimizations FAILED
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/Users/sdelamo/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-slf4j-impl/2.23.1/9ef67909a1b4eae999af4c7a211ab2379e4b86c2/log4j-slf4j-impl-2.23.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at io.micronaut.aot.cli.Main.executeInIsolatedLoader(Main.java:113)
        at io.micronaut.aot.cli.Main.run(Main.java:87)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at io.micronaut.aot.cli.Main.execute(Main.java:134)
        at io.micronaut.aot.cli.Main.main(Main.java:138)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.micronaut.aot.cli.Main.executeInIsolatedLoader(Main.java:107)
        ... 11 more
Caused by: java.lang.IllegalStateException: The logback.xml conversion feature requires logback 1.4 on the AOT optimizer classpath.
        at io.micronaut.aot.std.sourcegen.LogbackConfigurationSourceGenerator.generate(LogbackConfigurationSourceGenerator.java:53)
        at io.micronaut.aot.core.codegen.AbstractSingleClassFileGenerator.generate(AbstractSingleClassFileGenerator.java:35)
        at io.micronaut.aot.std.sourcegen.LogbackConfigurationSourceGenerator.generate(LogbackConfigurationSourceGenerator.java:85)
        at io.micronaut.aot.core.codegen.ApplicationContextConfigurerGenerator.generate(ApplicationContextConfigurerGenerator.java:66)
        at io.micronaut.aot.MicronautAotOptimizer$Runner.execute(MicronautAotOptimizer.java:343)
        at io.micronaut.aot.MicronautAotOptimizer.execute(MicronautAotOptimizer.java:202)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        ... 13 more
melix commented 6 days ago

I will take a look but I can't do it until Tuesday.