UnsupportedFeatureException: An object of type …NestedFileSystemProvider was found in the image heap

I’m using graalvm-jdk-22.0.1+8.1 to build a spring-boot-starter native container image, but I get the following error:

[INFO]     [creator]     ================================================================================
[INFO]     [creator]     GraalVM Native Image: Generating 'com.example.demo.DemoApplication' (executable)...
[INFO]     [creator]     ================================================================================
[INFO]     [creator]     For detailed information and explanations on the build output, visit:
[INFO]     [creator]     https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
[INFO]     [creator]     --------------------------------------------------------------------------------
[INFO]     [creator]     [1/8] Initializing...                                            (9.2s @ 0.13GB)
[INFO]     [creator]      Java version: 22.0.1+10, vendor version: Liberica-NIK-24.0.1-1
[INFO]     [creator]      Graal compiler: optimization level: 2, target machine: x86-64-v3
[INFO]     [creator]      C compiler: gcc (linux, x86_64, 11.4.0)
[INFO]     [creator]      Garbage collector: Serial GC (max heap size: 80% of RAM)
[INFO]     [creator]      2 user-specific feature(s):
[INFO]     [creator]      - com.oracle.svm.thirdparty.gson.GsonFeature
[INFO]     [creator]      - org.springframework.aot.nativex.feature.PreComputeFieldFeature
[INFO]     [creator]     --------------------------------------------------------------------------------
[INFO]     [creator]      2 experimental option(s) unlocked:
[INFO]     [creator]      - '-H:Name' (alternative API option(s): -o com.example.demo.DemoApplication; origin(s): command line)
[INFO]     [creator]      - '-H:+StaticExecutableWithDynamicLibC' (origin(s): command line)
[INFO]     [creator]     --------------------------------------------------------------------------------
[INFO]     [creator]     Build resources:
[INFO]     [creator]      - 8.83GB of memory (56.9% of 15.53GB system memory, determined at start)
[INFO]     [creator]      - 8 thread(s) (100.0% of 8 available processor(s), determined at start)
[INFO]     [creator]     SLF4J(W): No SLF4J providers were found.
[INFO]     [creator]     SLF4J(W): Defaulting to no-operation (NOP) logger implementation
[INFO]     [creator]     SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
[INFO]     [creator]     [2/8] Performing analysis...  []                                (51.5s @ 0.64GB)
[INFO]     [creator]         7,254 reachable types   (79.7% of    9,106 total)
[INFO]     [creator]         8,510 reachable fields  (48.4% of   17,574 total)
[INFO]     [creator]        30,520 reachable methods (51.2% of   59,658 total)
[INFO]     [creator]         2,514 types,   131 fields, and 1,782 methods registered for reflection
[INFO]     [creator]     
[INFO]     [creator]     Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: An object of type 'org.springframework.boot.loader.nio.file.NestedFileSystemProvider' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default.
[INFO]     [creator]     This is not allowed for correctness reasons: All objects that are stored in the image heap must be initialized at build time.
[INFO]     [creator]     
[INFO]     [creator]     You now have two options to resolve this:
[INFO]     [creator]     
[INFO]     [creator]     1) If it is intended that objects of type 'org.springframework.boot.loader.nio.file.NestedFileSystemProvider' are persisted in the image heap, add 
[INFO]     [creator]     
[INFO]     [creator]         '--initialize-at-build-time=org.springframework.boot.loader.nio.file.NestedFileSystemProvider'
[INFO]     [creator]     
[INFO]     [creator]     to the native-image arguments. Note that initializing new types can store additional objects to the heap. It is advised to check the static fields of 'org.springframework.boot.loader.nio.file.NestedFileSystemProvider' to see if they are safe for build-time initialization,  and that they do not contain any sensitive data that should not become part of the image.
[INFO]     [creator]     
[INFO]     [creator]     2) If these objects should not be stored in the image heap, you can use 
[INFO]     [creator]     
[INFO]     [creator]         '--trace-object-instantiation=org.springframework.boot.loader.nio.file.NestedFileSystemProvider'
[INFO]     [creator]     
[INFO]     [creator]     to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 
[INFO]     [creator]     
[INFO]     [creator]         '--initialize-at-run-time=<culprit>'
[INFO]     [creator]     
[INFO]     [creator]     to prevent the instantiation of the object.
[INFO]     [creator]     
[INFO]     [creator]     If you are seeing this message after upgrading to a new GraalVM release, this means that some objects ended up in the image heap without their type being marked with --initialize-at-build-time.
[INFO]     [creator]     To fix this, include '--initialize-at-build-time=org.springframework.boot.loader.nio.file.NestedFileSystemProvider' in your configuration. If the classes do not originate from your code, it is advised to update all library or framework dependencies to the latest version before addressing this error.
[INFO]     [creator]     
[INFO]     [creator]     The following detailed trace displays from which field in the code the object was reached.
[INFO]     [creator]     Object was reached by
[INFO]     [creator]       manually created constant
[INFO]     [creator]     --------------------------------------------------------------------------------
[INFO]     [creator]         6.1s (9.6% of total time) in 130 GCs | Peak RSS: 1.21GB | CPU load: 6.54
[INFO]     [creator]     ================================================================================
[INFO]     [creator]     Failed generating 'com.example.demo.DemoApplication' after 1m 1s.
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to contribute native-image layer
[INFO]     [creator]     error running build
[INFO]     [creator]     exit status 1
[INFO]     [creator]     ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:41 min
[INFO] Finished at: 2024-05-14T13:34:10+02:00
[INFO] ------------------------------------------------------------------------

I’ve also tried the --initialize-at-build-time suggestion without luck.

Steps to reproduce:

  1. Go to https://start.spring.io/
  2. Select: Maven, Java, Spring Boot 3.2.5, Jar packaging and Java 22.
  3. Add the “GraalVM Native Support” dependency.
  4. Download and unzip the project.
  5. Run ./mvnw -Pnative -DskipTests spring-boot:build-image
  6. The error above is displayed.

Any ideas on how to fix the issue and be able to build a native container image from the Spring Boot project with the provided options (Java 22, GraalVM JDK)?

Thanks in advance!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật