Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Native Image] Compilation for spring boot 3 application fails with : Error: ImageSingletons do not contain key com.oracle.svm.hosted.ProgressReporterFeature #10540

Open
1 task
abhimintoak opened this issue Jan 23, 2025 · 4 comments
Assignees

Comments

@abhimintoak
Copy link

abhimintoak commented Jan 23, 2025

Describe the Issue

Compilation for spring boot 3 application fails with :
Error: ImageSingletons do not contain key com.oracle.svm.hosted.ProgressReporterFeature

Describe GraalVM and your environment:

GraalVM version: 21.0.5-graal
JDK: openjdk version "17"
OS: MacOS 14.6.1
Maven Version: 3.9.8

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "21.0.5" 2024-10-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48, mixed mode, sharing)

Operating System and Version

MacOS 14.6.1

Build Command

${mvnHome}/bin/mvn clean package -Pnative native:build -X -e
-Dproject.version=${GitVersion_SemVer}
-Dmaven.test.skip=true
-Dquarkus.native.additional-build-args='--initialize-at-build-time=io.netty -H:DeadlockWatchdogInterval=10 -H:+DeadlockWatchdogExitOnTimeout -H:+TraceClassInitialization -H:+PrintAnalysisCallTree -J-Xmx6g'

Pom file

`
4.0.0

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.4</version>
    <relativePath/>
</parent>

<groupId>com.mintoak</groupId>
<artifactId>mintoak-hdfc-mmp</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>mintoak-hdfc-mmp</name>

<properties>
    <java.version>17</java.version>
    <spring-cloud.version>2023.0.2</spring-cloud.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <!-- Custom project dependency -->
    <dependency>
        <groupId>com.mintoak</groupId>
        <artifactId>mmp</artifactId>
        <version>7.0.2</version>
        <exclusions>
            <exclusion>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.nimbusds</groupId>
                <artifactId>nimbus-jose-jwt</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!--JUnit 5 (jupiter) and mockito dependencies -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-runner</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-reflect</artifactId>
        <version>2.0.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>4.25.1</version>
    </dependency>
    <dependency>
        <groupId>org.graalvm.nativeimage</groupId>
        <artifactId>svm</artifactId>
        <version>24.1.2</version>
        <scope>provided</scope>
    </dependency>
</dependencies>


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.java</include>
            </includes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>logback.xml</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.graalvm.buildtools</groupId>
            <artifactId>native-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.mintoak.MintoakHdfcMMPApplication</mainClass>
                <buildArgs>
                    <buildArg>-Ob</buildArg>
                    <buildArg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.c=ALL-UNNAMED</buildArg>
                    <buildArg>--rerun-class-initialization-at-runtime=org.bouncycastle.jcajce.provider.drbg.DRBG$Default,org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV</buildArg>
                    <buildArg>--initialize-at-build-time=org.bouncycastle.util.Strings,org.bouncycastle.util.Arrays,org.bouncycastle.util.Properties,org.bouncycastle.util.Pack,org.bouncycastle.util.Integers,org.bouncycastle.util.Properties$1,org.bouncycastle.crypto.digests.SHA512Digest,org.bouncycastle.crypto.digests.LongDigest,org.bouncycastle.crypto.params.KeyParameter,org.bouncycastle.jcajce.provider.drbg.DRBG$HybridSecureRandom,org.bouncycastle.crypto.prng.SP800SecureRandomBuilder$HashDRBGProvider,org.bouncycastle.crypto.prng.SP800SecureRandomBuilder$HMacDRBGProvider,org.bouncycastle.crypto.prng.drbg.HMacSP800DRBG,org.bouncycastle.jcajce.provider.drbg.DRBG$HybridSecureRandom$SignallingEntropySource,org.bouncycastle.crypto.prng.SP800SecureRandomBuilder,org.bouncycastle.crypto.prng.BasicEntropySourceProvider$1,org.bouncycastle.jcajce.provider.drbg.DRBG$2,org.bouncycastle.jcajce.provider.drbg.DRBG$HybridRandomProvider,org.bouncycastle.jcajce.provider.drbg.DRBG$HybridSecureRandom$SignallingEntropySource$EntropyGatherer,org.bouncycastle.crypto.prng.drbg.Utils,org.bouncycastle.crypto.prng.BasicEntropySourceProvider,org.bouncycastle.crypto.macs.HMac,org.bouncycastle.jcajce.provider.drbg.DRBG$HybridSecureRandom$1</buildArg>
                    <buildArg>--features=com.mintoak.BouncyCastleFeature</buildArg>
                    <arg>-H:IncludeLocales=fr,en</arg>
                    <arg>-H:DynamicProxyConfigurationFiles=src/main/resources/dynamic-proxy.json</arg>
                    <arg>-H:ReflectionConfigurationFiles=src/main/resources/reflect-config.json</arg>
                    <arg>-H:ResourceConfigurationFiles=src/main/resources/resource-config.json</arg>
                    <buildArg>-H:Log=debug</buildArg>
                </buildArgs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <classifier>app</classifier>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
                <append>true</append>
                <excludes>
                    <exclude>com/mintoak/oneapp/Payment/Beans/**</exclude>
                    <exclude>com/mintoak/Partner/Beans/**</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>post-unit-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>4.25.0</version>
            <configuration>
                <propertyFile></propertyFile>
                <changeLogFile></changeLogFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

`

Expected Behavior

The error should not happen

Actual Behavior

Getting the error at build time:

Error: ImageSingletons do not contain key com.oracle.svm.hosted.ProgressReporterFeature

Steps to Reproduce

NA. The code-base is proprietary

Additional Context

No response

Build Log Output and Error Messages

No response

@selhagani
Copy link
Member

Hi @abhimintoak

Thank you for reaching out to us!
Could you please try retesting with our latest GraalVM release? you can find it here: https://github.com/graalvm/graalvm-ce-builds/releases/

@abhimintoak
Copy link
Author

abhimintoak commented Jan 27, 2025

Hi @abhimintoak

Thank you for reaching out to us! Could you please try retesting with our latest GraalVM release? you can find it here: https://github.com/graalvm/graalvm-ce-builds/releases/

Hi @selhagani , thanks so much for the quick revert. We are using Java 17 and Spring boot: 3.2.4.
I tried using graal-23.0.2, with the project but still got the same error.

Image

@selhagani
Copy link
Member

I don’t see which version of native-maven-plugin you’re using here. Could you please use the latest available one as well? Also please try generating the configuration files using the tracing agent. If this doesn't work then can you please create a concise reproducer for your issue so that we can investigate this on our side?

@abhimintoak
Copy link
Author

hi @selhagani , i tried with latest native-maven-plugin and now this error is gone. Thanks so much.
There is a new error i am facing. Should I mention it in this ticket or raise a new one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants