#Native images AWS using GraalVM

1 messages · Page 1 of 1 (latest)

fast valve
#

I am using GraalVM and am building a serverless AWS Lambda.

The command I am running to make the binary:
native-image --no-server --no-fallback --enable-url-protocols=http -jar /build/libs/HelloWorldFunction.jar -H:Name=application

My build.gradle:

plugins {
    id 'java'
    id 'application'
    id 'com.github.johnrengelman.shadow' version '7.0.0'
}

def lambdaName = "HelloWorldFunction"

group = 'org.example'
version = '1.0-SNAPSHOT'

application {
    mainClassName = 'com.amazonaws.services.lambda.runtime.api.client.AWSLambda'
}

shadowJar {
    archiveBaseName.set(lambdaName)
    archiveClassifier.set('')
    archiveVersion.set('')
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.amazonaws:aws-lambda-java-core:1.2.3'
    implementation 'com.amazonaws:aws-lambda-java-events:3.13.0'
    implementation 'com.amazonaws:aws-lambda-java-runtime-interface-client:2.6.0'
}

Error message:

Failed to load the native runtime interface client library libaws-lambda-jni.linux-x86_64.so. Exception: Specified file not in the JAR: libaws-lambda-jni.linux-x86_64.so
Failed to load the native runtime interface client library libaws-lambda-jni.linux-aarch_64.so. Exception: Specified file not in the JAR: libaws-lambda-jni.linux-aarch_64.so
Failed to load the native runtime interface client library libaws-lambda-jni.linux_musl-x86_64.so. Exception: Specified file not in the JAR: libaws-lambda-jni.linux_musl-x86_64.so
Failed to load the native runtime interface client library libaws-lambda-jni.linux_musl-aarch_64.so. Exception: Specified file not in the JAR: libaws-lambda-jni.linux_musl-aarch_64.so
quasi harborBOT
#

<@&987246399047479336> please have a look, thanks.

cosmic tendon
#

are they provided by one of the amazon jars?

fast valve
#

no

#

I have managed to get past the error

#
native-image \
  --no-server \
  --no-fallback \
  --enable-url-protocols=http \
  --report-unsupported-elements-at-runtime \
  --initialize-at-build-time=com.amazonaws.services.lambda.runtime.api.client.AWSLambda \
  --initialize-at-run-time=com.amazonaws.services.lambda.runtime.api.client.runtimeapi.LambdaRuntimeClient \
  -H:ReflectionConfigurationFiles=/reflect-config.json \
  -H:ResourceConfigurationFiles=/resource-config.json \
  -H:IncludeResources='libaws-lambda-jni.*\\.so' \
  -H:+UnlockExperimentalVMOptions \
  -H:Name=application \
  -jar /build/libs/HelloWorldFunction.jar
#

this is getting out of hand

#

now I'm getting:

#
Exception in thread "main" java.lang.Error: com.amazonaws.services.lambda.runtime.serialization.util.ReflectUtil$ReflectException: java.lang.NoSuchFieldException: logger
        at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.startRuntime(AWSLambda.java:192)
        at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.main(AWSLambda.java:180)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: com.amazonaws.services.lambda.runtime.serialization.util.ReflectUtil$ReflectException: java.lang.NoSuchFieldException: logger
        at com.amazonaws.services.lambda.runtime.serialization.util.ReflectUtil.setStaticField(ReflectUtil.java:660)
        at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.setupRuntimeLogger(AWSLambda.java:142)
        at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.startRuntime(AWSLambda.java:201)
        at com.amazonaws.services.lambda.runtime.api.client.AWSLambda.startRuntime(AWSLambda.java:190)
fast valve
#

I give up with this stuff