Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Provide meaningful error message when logback.xml is detected #1415

Closed
skrese opened this issue Dec 31, 2021 · 6 comments
Closed

Provide meaningful error message when logback.xml is detected #1415

skrese opened this issue Dec 31, 2021 · 6 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@skrese
Copy link

skrese commented Dec 31, 2021

Environment:

OS Name	Microsoft Windows 10 Pro
Version	10.0.19043 Build 19043
Java version: OpenJDK Runtime Environment (build 17+35-2724)
Gradle Version: 7.3.2
Docker Version:  20.10.11, build dea9396

build.gradle

plugins {
	id 'org.springframework.boot' version '2.6.2'
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
	id 'java'
	id 'idea'
	id 'org.springframework.experimental.aot' version '0.11.1'
}

group = 'si.krese.sandi'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
	maven { url 'https://repo.spring.io/release' }
	mavenCentral()
}

dependencies {
	implementation "org.springframework.boot:spring-boot-starter-web"
	testImplementation "org.springframework.boot:spring-boot-starter-test"
}

test {
	useJUnitPlatform()
}

bootBuildImage {
	builder = 'paketobuildpacks/builder:tiny'
	environment = ['BP_NATIVE_IMAGE': 'true']
}

settings.gradle

pluginManagement {
	repositories {
		maven { url 'https://repo.spring.io/release' }
		mavenCentral()
		gradlePluginPortal()
	}
}
rootProject.name = '2-actors-in-movies'

./gradlew bootBuildImage

16:14:39: Executing 'bootBuildImage'...

> Task :compileJava
> Task :processResources
> Task :classes

> Task :generateAot
2021-12-31T15:14:42.956Z INFO  MUSHROOM o.s.a.b.ContextBootstrapContributor - Detected application class: si.krese.sandi.twoactors.TwoActorsInMoviesApplication
2021-12-31T15:14:42.960Z INFO  MUSHROOM o.s.a.b.ContextBootstrapContributor - Processing application context
2021-12-31T15:14:50.223Z INFO  MUSHROOM o.s.a.b.ContextBootstrapContributor - Processed 129 bean definitions in 7256ms
2021-12-31T15:14:50.806Z INFO  MUSHROOM o.s.nativex.support.SpringAnalyzer - Spring Native operating mode: native

> Task :compileAotMainJava
warning: unknown enum constant When.MAYBE
  reason: class file for javax.annotation.meta.When not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\projects\5tudio\2-actors-in-movies\build\generated\sources\aotMain\org\springframework\aot\StaticSpringFactories.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning

> Task :processAotMainResources
> Task :aotMainClasses
> Task :aotMainJar
> Task :bootJarMainClassName
> Task :bootJar

> Task :bootBuildImage
Building image 'docker.io/library/2-actors-in-movies:0.0.1-SNAPSHOT'

 > Pulling builder image 'docker.io/paketobuildpacks/builder:tiny' ..................................................
 > Pulled builder image 'paketobuildpacks/builder@sha256:4877616ba957561ce31481840ad27023360668a342a2568b52263dcb2724de7b'
 > Pulling run image 'docker.io/paketobuildpacks/run:tiny-cnb' ..................................................
 > Pulled run image 'paketobuildpacks/run@sha256:1437105c9653b935ffba12ef35400ce7868e80465778759255a0da268fd7f1f2'
 > Executing lifecycle version v0.13.2
 > Using build cache volume 'pack-cache-a6ce060ba929.build'

 > Running creator
    [creator]     ===> DETECTING
    [creator]     6 of 14 buildpacks participating
    [creator]     paketo-buildpacks/ca-certificates   3.0.2
    [creator]     paketo-buildpacks/bellsoft-liberica 9.0.2
    [creator]     paketo-buildpacks/syft              1.3.1
    [creator]     paketo-buildpacks/executable-jar    6.0.2
    [creator]     paketo-buildpacks/spring-boot       5.3.0
    [creator]     paketo-buildpacks/native-image      5.0.2
    [creator]     ===> ANALYZING
    [creator]     Previous image with name "docker.io/library/2-actors-in-movies:0.0.1-SNAPSHOT" not found
    [creator]     ===> RESTORING
    [creator]     ===> BUILDING
    [creator]     
    [creator]     Paketo CA Certificates Buildpack 3.0.2
    [creator]       https://github.com/paketo-buildpacks/ca-certificates
    [creator]       Launch Helper: Contributing to layer
    [creator]         Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
    [creator]     
    [creator]     Paketo BellSoft Liberica Buildpack 9.0.2
    [creator]       https://github.com/paketo-buildpacks/bellsoft-liberica
    [creator]       Build Configuration:
    [creator]         $BP_JVM_TYPE                 JRE             the JVM type - JDK or JRE
    [creator]         $BP_JVM_VERSION              17.*            the Java version
    [creator]       Launch Configuration:
    [creator]         $BPL_DEBUG_ENABLED           false           enables Java remote debugging support
    [creator]         $BPL_DEBUG_PORT              8000            configure the remote debugging port
    [creator]         $BPL_DEBUG_SUSPEND           false           configure whether to suspend execution until a debugger has attached
    [creator]         $BPL_HEAP_DUMP_PATH                          write heap dumps on error to this path
    [creator]         $BPL_JAVA_NMT_ENABLED        true            enables Java Native Memory Tracking (NMT)
    [creator]         $BPL_JAVA_NMT_LEVEL          summary         configure level of NMT, summary or detail
    [creator]         $BPL_JFR_ARGS                                configure custom Java Flight Recording (JFR) arguments
    [creator]         $BPL_JFR_ENABLED             false           enables Java Flight Recording (JFR)
    [creator]         $BPL_JMX_ENABLED             false           enables Java Management Extensions (JMX)
    [creator]         $BPL_JMX_PORT                5000            configure the JMX port
    [creator]         $BPL_JVM_HEAD_ROOM           0               the headroom in memory calculation
    [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes  the number of loaded classes in memory calculation
    [creator]         $BPL_JVM_THREAD_COUNT        250             the number of threads in memory calculation
    [creator]         $JAVA_TOOL_OPTIONS                           the JVM launch flags
    [creator]       BellSoft Liberica NIK 17.0.1: Contributing to layer
    [creator]         Downloading from https://download.bell-sw.com/vm/21.3.0/bellsoft-liberica-vm-core-openjdk17-21.3.0-linux-amd64.tar.gz
    [creator]         Verifying checksum
    [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/native-image-svm
    [creator]         Adding 128 container CA certificates to JVM truststore
    [creator]         Writing env.build/JAVA_HOME.override
    [creator]         Writing env.build/JDK_HOME.override
    [creator]     
    [creator]     Paketo Syft Buildpack 1.3.1
    [creator]       https://github.com/paketo-buildpacks/syft
    [creator]         Downloading from https://github.com/anchore/syft/releases/download/v0.33.0/syft_0.33.0_linux_amd64.tar.gz
    [creator]         Verifying checksum
    [creator]         Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
    [creator]     
    [creator]     Paketo Executable JAR Buildpack 6.0.2
    [creator]       https://github.com/paketo-buildpacks/executable-jar
    [creator]       Class Path: Contributing to layer
    [creator]         Writing env.build/CLASSPATH.delim
    [creator]         Writing env.build/CLASSPATH.prepend
    [creator]     
    [creator]     Paketo Spring Boot Buildpack 5.3.0
    [creator]       https://github.com/paketo-buildpacks/spring-boot
    [creator]       Class Path: Contributing to layer
    [creator]         Writing env.build/CLASSPATH.append
    [creator]         Writing env.build/CLASSPATH.delim
    [creator]       Image labels:
    [creator]         org.springframework.boot.version
    [creator]     
    [creator]     Paketo Native Image Buildpack 5.0.2
    [creator]       https://github.com/paketo-buildpacks/native-image
    [creator]       Build Configuration:
    [creator]         $BP_NATIVE_IMAGE                  true  enable native image build
    [creator]         $BP_NATIVE_IMAGE_BUILD_ARGUMENTS        arguments to pass to the native-image command
    [creator]       Native Image: Contributing to layer
    [creator]         GraalVM 21.3.0 Java 17 CE (Java Version 17.0.1+12-LTS)
    [creator]         Executing native-image -H:+StaticExecutableWithDynamicLibC -H:Name=/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/spring-native-0.11.1.jar:/workspace/BOOT-INF/lib/spring-webmvc-5.3.14.jar:/workspace/BOOT-INF/lib/spring-web-5.3.14.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-2.6.2.jar:/workspace/BOOT-INF/lib/spring-boot-2.6.2.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar:/workspace/BOOT-INF/lib/spring-context-5.3.14.jar:/workspace/BOOT-INF/lib/spring-expression-5.3.14.jar:/workspace/BOOT-INF/lib/spring-aop-5.3.14.jar:/workspace/BOOT-INF/lib/spring-beans-5.3.14.jar:/workspace/BOOT-INF/lib/spring-core-5.3.14.jar:/workspace/BOOT-INF/lib/snakeyaml-1.29.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.13.1.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.13.1.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.13.1.jar:/workspace/BOOT-INF/lib/jackson-core-2.13.1.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.13.1.jar:/workspace/BOOT-INF/lib/jackson-databind-2.13.1.jar:/workspace/BOOT-INF/lib/tomcat-embed-websocket-9.0.56.jar:/workspace/BOOT-INF/lib/tomcat-embed-core-9.0.56.jar:/workspace/BOOT-INF/lib/tomcat-embed-el-9.0.56.jar:/workspace/BOOT-INF/lib/logback-classic-1.2.9.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.17.0.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-1.7.32.jar:/workspace/BOOT-INF/lib/spring-jcl-5.3.14.jar:/workspace/BOOT-INF/lib/logback-core-1.2.9.jar:/workspace/BOOT-INF/lib/slf4j-api-1.7.32.jar:/workspace/BOOT-INF/lib/log4j-api-2.17.0.jar:/workspace/BOOT-INF/lib/2-actors-in-movies-0.0.1-SNAPSHOT-aot.jar si.krese.sandi.twoactors.TwoActorsInMoviesApplication
    [creator]     [/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication:205]    classlist:   7,386.92 ms,  0.94 GB
    [creator]     [/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication:205]        (cap):   1,881.00 ms,  0.94 GB
    [creator]     Warning: Could not register org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: org/springframework/jdbc/CannotGetJdbcConnectionException.
    [creator]     Warning: Could not register org.springframework.boot.diagnostics.analyzer.ValidationExceptionFailureAnalyzer: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: javax/validation/ValidationException.
    [creator]     Warning: Could not register org.springframework.boot.liquibase.LiquibaseChangelogMissingFailureAnalyzer: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: liquibase/exception/ChangeLogParseException.
    [creator]     [/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication:205]        setup:   7,366.97 ms,  0.94 GB
    [creator]     The bundle named: org.apache.tomcat.util.threads.res.LocalStrings, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
    [creator]     Warning: Could not register complete reflection metadata for org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator. Reason(s): java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
    [creator]     Warning: Could not register complete reflection metadata for org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer. Reason(s): java.lang.NoClassDefFoundError: org/springframework/jdbc/CannotGetJdbcConnectionException
    [creator]     Warning: Could not register complete reflection metadata for org.springframework.boot.liquibase.LiquibaseChangelogMissingFailureAnalyzer. Reason(s): java.lang.NoClassDefFoundError: liquibase/exception/ChangeLogParseException
    [creator]     Warning: Could not register complete reflection metadata for org.springframework.boot.diagnostics.analyzer.ValidationExceptionFailureAnalyzer. Reason(s): java.lang.NoClassDefFoundError: javax/validation/ValidationException
    [creator]     Warning: Could not register complete reflection metadata for org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator. Reason(s): java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
    [creator]     To see how the classes got initialized, use --trace-class-initialization=javax.xml.parsers.FactoryFinder,jdk.xml.internal.SecuritySupport
    [creator]     [/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication:205]     analysis: 170,823.69 ms,  6.93 GB
    [creator]     Error: Classes that should be initialized at run time got initialized during image building:
    [creator]      javax.xml.parsers.FactoryFinder was unintentionally initialized at build time. To see why javax.xml.parsers.FactoryFinder got initialized use --trace-class-initialization=javax.xml.parsers.FactoryFinder
    [creator]     jdk.xml.internal.SecuritySupport was unintentionally initialized at build time. To see why jdk.xml.internal.SecuritySupport got initialized use --trace-class-initialization=jdk.xml.internal.SecuritySupport
    [creator]     
    [creator]     Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
    [creator]     [/layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication:205]      [total]: 186,282.21 ms,  6.93 GB
    [creator]     # Printing build artifacts to: /layers/paketo-buildpacks_native-image/native-image/si.krese.sandi.twoactors.TwoActorsInMoviesApplication.build_artifacts.txt
    [creator]     Error: Image build request failed with exit status 1
    [creator]     unable to invoke layer creator
    [creator]     unable to contribute native-image layer
    [creator]     error running build
    [creator]     exit status 1
    [creator]     ERROR: failed to build: exit status 1

> Task :bootBuildImage FAILED
9 actionable tasks: 9 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 145

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 47s
16:19:28: Execution finished 'bootBuildImage'.

@snicoll
Copy link
Contributor

snicoll commented Jan 2, 2022

It's hard for us to provide support with the information you've shared. Can you share a small project that reproduces the problem so that we can run it ourselves?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jan 2, 2022
@skrese
Copy link
Author

skrese commented Jan 2, 2022

I thought it might not be enough info. How can I send you the project, via email perhaps?

@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 3, 2022

Please just attach a zip archive to this issue (drag and drop).

Also please make sure you are using Docker WSL2 backend.

@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 3, 2022

I can reproduce the error, it is due to src/main/resources/logback.xml file which is not supported yet as documented.

But I think we can provide more meaningful error for that popular use case.

@sdeleuze sdeleuze added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 3, 2022
@sdeleuze sdeleuze self-assigned this Jan 3, 2022
@sdeleuze sdeleuze added this to the 0.11.2 milestone Jan 3, 2022
@sdeleuze sdeleuze changed the title Builder lifecycle 'creator' failed with status code 145 Provide meaningful error message when logback.xml is detected Jan 3, 2022
@skrese
Copy link
Author

skrese commented Jan 3, 2022

Thank you for your clarification. I wasn't aware of the lack of support for Logback. Since Logback is a very useful library, are you working on it? If nothing else, those CVE issues are supposedly not an issue.

@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 3, 2022

Logback is supported, embedded configuration with src/main/resources/logback.xml not yet, see the documentation for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Development

No branches or pull requests

3 participants