Quarkus: Alexa SDK not working in native mode

Created on 3 Jan 2020  路  5Comments  路  Source: quarkusio/quarkus

Describe the bug
When trying to use Alexa SDK with Quarkus, it works in non-native mode, but fails when compiling in native mode.

Expected behavior
I would expect it to compile smoothly in native mode.

Actual behavior
The compilation fails because of reference to unsupported methods.

For instance:

Error: Unsupported method java.lang.Thread.suspend0() is reachable: Native method. If you intend to use the Java Native Interface (JNI), specify -H:+JNI and see also -H:JNIConfigurationFiles=<path> (use -H:+PrintFlags for details)
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Call path from entry point to java.lang.Thread.suspend0(): 
    at java.lang.Thread.suspend0(Thread.java)
    at java.lang.Thread.suspend(Thread.java:1032)
    at com.oracle.svm.reflect.Thread_suspend_24fd610340ceeb89fae387dad76129cadeeda10a_48.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at javax.enterprise.util.AnnotationLiteral.invoke(AnnotationLiteral.java:288)
    at javax.enterprise.util.AnnotationLiteral.getMemberValue(AnnotationLiteral.java:276)
    at javax.enterprise.util.AnnotationLiteral.toString(AnnotationLiteral.java:135)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.oracle.svm.core.amd64.AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(AMD64CPUFeatureAccess.java:179)
    at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:129)
    at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
    at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

    at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:133)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:579)
    ... 6 more

To Reproduce
Steps to reproduce the behavior:

  1. mvn archetype:generate -DarchetypeGroupId=io.quarkus -DarchetypeArtifactId=quarkus-amazon-lambda-archetype -DarchetypeVersion=1.1.0.Final
  2. Add com.amazon.alexa:ask-sdk:2.27.1 dependency to pom.xml
  3. Invoke new SkillStreamHandler(Skills.standard().build()){} in the constructor of TestLambda class
  4. mvn clean install -Pnative -Dnative-image.docker-build=true

Environment

  • Linux mypc-ThinkPad-T410 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • openjdk version "11.0.5" 2019-10-15
    OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
    OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)
  • GraalVM version: graalvm-ce-java11-19.3.0
  • Quarkus version 1.1.0-Final
kinquestion

All 5 comments

That basically means we need an extension for making Alexa SDK work with GraalVM.

Hello @fcracker79,

Does using the following command work:

mvn clean install -Pnative -Dnative-image.docker-build=true -Dquarkus.native.enable-jni=true

Thanks @jaikiran, it worked!

Please let me know if I need to close the issue.

If it just needs JNI to work, I think we can close that one as JNI will be always enabled once we move to GraalVM 19.3.

My issue is solved.

Was this page helpful?
0 / 5 - 0 ratings