using jib when building with 2.2.6 the container won't come up without any error the java process just jumps the gun and exits with -1 changing spring boot version back to 2.2.5 and it works again
used plugins ...
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
id "org.jetbrains.kotlin.plugin.spring" version '1.3.71'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'com.google.cloud.tools.jib' version '2.1.0'
id 'org.springframework.boot' version '2.2.6.RELEASE'
id "org.jlleitschuh.gradle.ktlint" version '9.2.1'
}
and baseimage is
jib {
from.image = 'openjdk:11.0.6-jre-slim'
....
}
**Comment From: wilkinsona**
There's nothing in Spring Boot that's jib-specific so I would expect it to be possible to reproduce the problem without involving jib. Does the app run successfully when built by other means?
If you would like us to spend some time investigating, we'll need to be able to reproduce the problem. To that end, can you please provide a complete and minimal sample? You can share it with us by zipping it up and attaching it to this issue or by pushing it to a separate repository.
**Comment From: 5V715**
will try to create a minimal project where this can be reproduced
**Comment From: 5V715**
here we go
https://github.com/5V715/sample-jib-fail
i also could minimize it down to a possible cause ...
when you remove the file src/resources/logback-spring.xml from the project
and then run jibDockerBuild the container will come up
also:
with the file (src/resources/logback-spring.xml) present changing the spring boot version to 2.2.5 the containered app comes up.
**Comment From: wilkinsona**
Thanks for the sample. As suspected, the problem isn't specific to Jib.
The failure is silent because an exception is being thrown while configuring Logback which results in all logging being disabled. You can see the exception by catching it and printing its stack trace in the application's main method.
java.lang.NoClassDefFoundError: org/codehaus/commons/compiler/io/TeeReader at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:206) at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:82) at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:77) at ch.qos.logback.core.joran.conditional.PropertyEvalScriptBuilder.build(PropertyEvalScriptBuilder.java:47) at ch.qos.logback.core.joran.conditional.IfAction.begin(IfAction.java:65) at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:269) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:128) at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53) at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:178) at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:155) at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80) at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60) at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:118) at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:313) at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:288) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at sample.App.main(App.java:11) Caused by: java.lang.ClassNotFoundException: org.codehaus.commons.compiler.io.TeeReader at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 33 more
`TeeReader` is missing from the classpath because you are using inconsistent versions of Janino's modules:
org.codehaus.janino:janino:3.1.0 org.codehaus.janino:commons-compiler:3.1.0 -> 3.1.2
Spring Boot provides dependency management for Janino and upgraded to 3.1.2 in 2.2.6. Your problem can be fixed by removing the version from your Janino dependency declaration:
implementation 'org.codehaus.janino:janino'
With this change in place, the application will start:
$ docker run sample-jib-fail:0.0.1
. _ _ __ _ _ /\ / ' __ _ () __ __ _ \ \ \ \ ( ( )_ | ' | '| | ' \/ _` | \ \ \ \ \/ )| |)| | | | | || (| | ) ) ) ) ' |_| .|| ||| |_, | / / / / =========|_|==============|/=//// :: Spring Boot :: (v2.2.6.RELEASE)
2020-03-31 10:03:51.802 INFO 1 --- [ main] sample.App : Starting App on 846ebcd3dc2e with PID 1 (/app/classes started by root in /) 2020-03-31 10:03:51.807 INFO 1 --- [ main] sample.App : No active profile set, falling back to default profiles: default 2020-03-31 10:03:53.315 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '' 2020-03-31 10:03:53.911 INFO 1 --- [ main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port(s): 8080 2020-03-31 10:03:53.918 INFO 1 --- [ main] sample.App : Started App in 3.247 seconds (JVM running for 3.791) ```
You may want to review all of your dependencies as there are others that declare a version that is not necessary as they are covered by Spring Boot's dependency management or the dependency management of the other boms that your application imports.