spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support
https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
Apache License 2.0
2.74k stars 356 forks source link

Problem with building native image for docker #1575

Closed ulinay closed 2 years ago

ulinay commented 2 years ago

Builder: Gradle id 'org.springframework.boot' version '2.6.6' id 'org.springframework.experimental.aot' version '0.11.4'

I'm using the next configuration to build native image:

bootBuildImage {
    builder = "paketobuildpacks/builder:tiny"
    environment = [
            "BP_NATIVE_IMAGE" : "true",
            //"BP_NATIVE_IMAGE_BUILD_ARGUMENTS" : "--initialize-at-run-time=com.google.common.jimfs.SystemJimfsFileSystemProvider"
    ]
}

When I try to build native image I've got this error: Error: Classes that should be initialized at run time got initialized during image building: com.google.common.jimfs.SystemJimfsFileSystemProvider was unintentionally initialized at build time. To see why com.google.common.jimfs.SystemJimfsFileSystemProvider got initialized use --trace-class-initialization=com.google.common.jimfs.SystemJimfsFileSystemProvider

Also I was trying to add this argument --initialize-at-run-time=com.google.common.jimfs.SystemJimfsFileSystemProvider but then I've got another error: Error: The class com.google.common.jimfs.SystemJimfsFileSystemProvider has already been initialized (from the command line with 'com.google.common.jimfs.SystemJimfsFileSystemProvider'); it is too late to register com.google.common.jimfs.SystemJimfsFileSystemProvider for build-time initialization. To see why com.google.common.jimfs.SystemJimfsFileSystemProvider got initialized use --trace-class-initialization=com.google.common.jimfs.SystemJimfsFileSystemProvider

mhalbritter commented 2 years ago

If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

spring-projects-issues commented 2 years ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues commented 2 years ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.