Spring boot Native Image build error: Element in class initialization configuration must end in

119 views Asked by At

When I want to build the spring boot application with "native-maven-plugin", I get the error I shared. I am sharing my pom file and build output.

Spring Boot 3.1.4 Graalvm 21

Pom:

<build>
    <plugins>
        <plugin>
            <groupId>org.graalvm.buildtools</groupId>
            <artifactId>native-maven-plugin</artifactId>
            <version>0.9.27</version>

            <configuration>
                <mainClass>tr.com.test.test2.guide.microservices.ui.server.UIServer</mainClass>
                <verbose>true</verbose>
                <buildArgs>
                    <buildArg>-H:+ReportExceptionStackTraces</buildArg>
                </buildArgs>
            </configuration>
        </plugin>
    </plugins>
</build>

Build Output:

[1/8] Initializing...                                                                                    (0,0s @ 0,17GB)
Error: Element in class initialization configuration must end in :run_t�me, :rerun, or :bu�ld_t�me. Found: org.springframework.aot.nativex.feature.ThrowawayClassLoader:build_time (from 'META-INF\native-image\org.springframework\spring-core\native-image.properties' in 'file:///C:/Users/userXXX/.m2/repository-default/org/springframework/spring-core/6.0.12/spring-core-6.0.12.jar')
com.oracle.svm.core.util.UserError$UserException: Element in class initialization configuration must end in :run_t�me, :rerun, or :bu�ld_t�me. Found: org.springframework.aot.nativex.feature.ThrowawayClassLoader:build_time (from 'META-INF\native-image\org.springframework\spring-core\native-image.properties' in 'file:///C:/Users/userXXX/.m2/repository-default/org/springframework/spring-core/6.0.12/spring-core-6.0.12.jar')
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.lambda$processClassInitializationOptions$1(ClassInitializationFeature.java:86)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.processClassInitializationOptions(ClassInitializationFeature.java:81)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:880)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:591)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:551)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
------------------------------------------------------------------------------------------------------------------------
                        0,2s (8,1% of total time) in 12 GCs | Peak RSS: 0,55GB | CPU load: 5,48
Error: ImageSingletons do not contain key com.oracle.svm.hosted.ProgressReporterFeature

I was expecting it to build successfully.

0

There are 0 answers