Reputation: 2582
I want to create a java project with quarkus and want to use GraalVm for ahead of time compilation to lower cold startup times in AWS lambda.
When I deploy it in AWS Lambda and run Test I get the following error:
Class not found: de.timguy.lambda.GreetingLambda: java.lang.ClassNotFoundException
java.lang.ClassNotFoundException: de.timguy.lambda.GreetingLambda. Current classpath: file:/var/task/
Steps I took
gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true
Version info: GraalVM 22.0.0.2 Java 11 CE 3 user-provided feature(s) - io.quarkus.runner.AutoFeature - io.quarkus.runtime.graal.DisableLoggingAutoFeature - io.quarkus.runtime.graal.ResourcesFeature Produced artifacts: /project/quark2-1.0.0-SNAPSHOT-runner (executable) /project/quark2-1.0.0-SNAPSHOT-runner.build_artifacts.txt Finished generating 'quark2-1.0.0-SNAPSHOT-runner' in 11m 54s. BUILD SUCCESSFUL in 12m 52s
Upvotes: 0
Views: 1060
Reputation: 852
Quarkus will produce a special zip file when it's targeting AWS Lambda. If you open it you will see a bootstrap file. The bootstrap file is only used with the custom runtimes. The custom runtimes know to execute that when they start up.
If you deploy a native executable to a Java-managed runtime by mistake then the JVM will not be able to find your handler method because it isn't a class on the classpath but a native executable instead.
Quarkus knows how to package your Lambda function this way because you've used the amazon-lambda extension.
Upvotes: 3
Reputation: 2582
I choosed the wrong runtime setting:
(Still curios about:
Upvotes: 0