Skip to content

ExceptionInInitializerError when calling AwsIotMqttConnectionBuilder.newMtlsBuilder() #651

@vinit-mahitech

Description

@vinit-mahitech

Describe the bug

I am migrating from aws-sdk-android to aws-iot-device-sdk-java-v2.
While creating an MqttClientConnection instance, I encounter the following runtime error:

java.lang.ExceptionInInitializerError
    at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:104)
    at software.amazon.awssdk.iot.AwsIotMqttConnectionBuilder.newMtlsBuilder(AwsIotMqttConnectionBuilder.java:121)
    ...
Caused by: software.amazon.awssdk.crt.CrtRuntimeException: Unable to unpack AWS CRT library
    at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:346)
    at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:50)
    at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:104)
    at software.amazon.awssdk.iot.AwsIotMqttConnectionBuilder.newMtlsBuilder(AwsIotMqttConnectionBuilder.java:121)
    ...

Expected Behavior

MqttClientConnection should be created successfully without throwing an error.

Current Behavior

Calling newMtlsBuilder() results in ExceptionInInitializerError due to a CrtRuntimeException.

Reproduction Steps

val clientConnection = AwsIotMqttConnectionBuilder
    .newMtlsBuilder(thingCert, thingCertKey)
    .withEndpoint(endpoint)
    .withClientId(clientId)
    .withCleanSession(false)
    .withReconnectTimeoutSecs(1, 32)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.27.0

Environment details (OS name and version, etc.)

Android 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions