Skip to content

aws-crt-java causes an error when native compiled with graalvm #780

Closed
@klopfdreh

Description

@klopfdreh

Describe the bug

Spring Boot Native build is not possible with aws-crt-java as there are many errors during the runtime.

Expected Behavior

Spring Boot Native build should run and use the JNI functionalities as it would run in a JVM.

Current Behavior

There are several issues during the runtime see solution.

Reproduction Steps

Perform a native-image build with GraalVM with Spring Boot 3.2.x.

Possible Solution

  1. Add a reflect-config.json and add the following content
[
  {
    "name": "software.amazon.awssdk.crt.s3.S3Client",
    "methods": [
      {
        "name": "<init>",
        "parameterTypes": []
      }
    ]
  }
]

This is required during the native build -H:ReflectionConfigurationResources=META-INF/.../reflect-config.json

  1. Add a resource-config.json and add the following content
{
  "resources": [
    {
      "pattern": "linux/x86_64/glibc/libaws-crt-jni.so"
    },
    ...
  ]
}

Note: ... means for each so-file.

This is require during the native build -H:ResourceConfigurationResources=META-INF/.../resource-config.json

  1. Provide the required JNI information with jni-config.json for the JNI resources so that it can be applied like described here: https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/JNI/ and here https://docs.oracle.com/en/graalvm/enterprise/20/docs/reference-manual/native-image/JNI/#integration - alternatively apply the code as a custom Feature

Additional Information/Context

I already tried to add the reflect-config.json and the resource-config.json into the classpath and run the image but failed with the following error inside the container: container.log

Is there any hint how to use AWS CRT with Spring Boot Native?

aws-crt-java version used

v0.29.18

Java version used

jdk17.0.10

Operating System and version

linux / ubi9-minimal:9.3-1612

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions