Skip to content

Native executable (not working with AWS CRT) #408

@Silaszur

Description

@Silaszur

Describe the bug

When I create a native executable with GraalVM using aws-iot-device-sdk-java-v2 (for subscribing to a aws topic), and execute it, I get the following:

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll
java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll

When I create native executables with packages other than aws packages, I have no issues.
I was also able to get the aws-crt-jni.dll from the aws-crt jar manually from the jar file, so I don't understand why I am getting this.
When I run my Subscriber the normal way it all works
I am pretty new to all of this and can't seem to find a fix.

Any help to resolve this issue would be greatly appreciated.

more of the error:

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll
java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll
at software.amazon.awssdk.crt.CRT.extractAndLoadLibrary(CRT.java:193)
at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:245)
at software.amazon.awssdk.crt.CRT.(CRT.java:35)
at software.amazon.awssdk.crt.CrtResource.(CrtResource.java:104)
at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:528)
at sub.Subscriber.run(Subscriber.java:67)
at sub.App.main(App.java:8)
Exception in thread "main" java.lang.ExceptionInInitializerError
at software.amazon.awssdk.crt.CrtResource.(CrtResource.java:104)
at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:528)
at sub.Subscriber.run(Subscriber.java:67)
at sub.App.main(App.java:8)
Caused by: software.amazon.awssdk.crt.CrtRuntimeException: software.amazon.awssdk.crt.CrtRuntimeException: Unable to unpack AWS CRT library UNKNOWN(-1) UNKNOWN(-1)
at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:255)
at software.amazon.awssdk.crt.CRT.(CRT.java:35)
... 4 more

Expected Behavior

I expect to be able to create a native executable and run it without getting:

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll
java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll

Current Behavior

Whenever I execute the the native executable I get:

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll
java.io.IOException: Unable to open library in jar for AWS CRT: /windows/x86_64/aws-crt-jni.dll

Reproduction Steps

Any sample using software.amazon.awssdk.crt to create a connection with mqtt and creating a native executable with it.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

aws-iot-device-sdk:1.12.0

Environment details (OS name and version, etc.)

Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessp2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 2 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions