I've created as simple demo project using spring initializer with spring-cloud-config-server
(2022.0.0-RC1) and Graalvm native image (0.9.17). Running ./gradlew nativeRun
failes with the following errors:
org.apache.sshd.common.util.io.IoUtils was unintentionally initialized at build time. To see why org.apache.sshd.common.util.io.IoUtils got initialized use --trace-class-initialization=org.apache.sshd.common.util.io.IoUtils
org.apache.sshd.sftp.client.fs.SftpFileSystemProvider was unintentionally initialized at build time. To see why org.apache.sshd.sftp.client.fs.SftpFileSystemProvider got initialized use --trace-class-initialization=org.apache.sshd.sftp.client.fs.SftpFileSystemProvider
org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
ch.qos.logback.classic.Logger was unintentionally initialized at build time. To see why ch.qos.logback.classic.Logger got initialized use --trace-class-initialization=ch.qos.logback.classic.Logger
To see how the classes got initialized, use --trace-class-initialization=org.apache.sshd.common.util.GenericUtils,org.bouncycastle.jce.provider.BouncyCastleProvider,org.apache.sshd.common.util.io.IoUtils,org.apache.sshd.sftp.client.fs.SftpFileSystemProvider,org.slf4j.LoggerFactory,ch.qos.logback.classic.Logger
To me it looks like configuration on the part of Spring is missing here.
Steps to reproduce:
1. Check out https://github.com/Hayvon/spring-cloud-config-server-graalvm
2. ./gradlew nativeRun
Comment From: OlgaMaciaszek
Hello @Hayvon, native support in Config Server is not going to be available till the blocking graal#5134 issue is fixed in GraalVM. Please see the docs.
Comment From: Hayvon
Thank you for the quick reply. 👍 I missed the entry in the documentation.
Comment From: OlgaMaciaszek
Np. I've just recently added it.
Comment From: wylswz
excluding dependencies worked for me
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.apache</artifactId>
</exclusion>
</exclusions>
</dependency>
Comment From: OlgaMaciaszek
Sure, but you need to keep in mind that this might affect the functionality. However, if you're not using those features, it might be helpful. Will add more info to docs.
Comment From: OlgaMaciaszek
Actually, there's too much functionality that would not be supported (i.e. git access) for this approach to be recommended as an alternative in the docs.