oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.38k stars 1.64k forks source link

Spring boot build error: Element in class initialization configuration must end in... #7628

Closed bakimermer closed 9 months ago

bakimermer commented 1 year ago

Hello,

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:

`<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

microservices tr.com.test.test2.guide 1.0-SNAPSHOT
<modelVersion>4.0.0</modelVersion>

<artifactId>ui-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>UI server</name>
<description>Web UI Backend Point</description>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>tr.com.test.test2.guide.depends</groupId>
        <artifactId>oracletopoloy</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

<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>

`

Error:

`======================================================================================================================== GraalVM Native Image: Generating 'ui-server' (executable)...

For detailed information and explanations on the build output, visit: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md

[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`

medoussboug commented 1 year ago

Hello, the logs are mal formatted and I can't see a way to reproduce. You will need to follow the templates in here for us to be able to process your issue.