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

Aot build failure with commons-beanutils dependency #1749

Closed kartik-kaushik closed 1 year ago

kartik-kaushik commented 1 year ago

Describe the bug Spring Boot 3 native build fail with commons-beanutils dependency

Sample Via the Spring Initializer, create any project with:

spring-boot-starter-parent:3.0.1 and add dependency commons-beanutils : 1.9.4

the application works normally, but when passing through the AOT phase, the build fails with this error:

Error: Unsupported features in 4 methods Detailed message: Error: Detected a ZipFile object in the image heap. A ZipFile object contains pointers to unmanaged C memory and file descriptors, and these resources are no longer available at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.util.jar.JarFile. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point.

It's is the simple project with just main class. Kindly suggest.

kartik-kaushik commented 1 year ago

The above worked by excluding the commons-logging from bean utils dependency. Thanks.