question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No virtual method setEndpointIdentificationAlgorithm

See original GitHub issue

Hello guys. I found one problem.

Lib crashed if it used on Android API less than 24.

Calling this constructor:

    public AWSIotMqttClient(String clientEndpoint, String clientId, KeyStore keyStore, String keyPassword) {
        super(clientEndpoint, clientId, keyStore, keyPassword);
    }

Will cause following exception:

java.lang.NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters; or its super classes (declaration of 'javax.net.ssl.SSLParameters' appears in /system/framework/core-libart.jar)
                      at com.amazonaws.services.iot.client.util.AwsIotTlsSocketFactory.ensureTls(AwsIotTlsSocketFactory.java:124)
                      at com.amazonaws.services.iot.client.util.AwsIotTlsSocketFactory.createSocket(AwsIotTlsSocketFactory.java:80)
                      at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:69)
                      at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule.java:86)
                      at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650)
                      at java.lang.Thread.run(Thread.java:818)

if you will look into the AwsIotTlsSocketFactory#ensureTls method, you’ll see next code:

    private Socket ensureTls(Socket socket) {
        if (socket != null && (socket instanceof SSLSocket)) {
            ((SSLSocket) socket).setEnabledProtocols(new String[] { TLS_V_1_2 });

            // Ensure hostname is validated againt the CN in the certificate
            SSLParameters sslParams = new SSLParameters();
            sslParams.setEndpointIdentificationAlgorithm("HTTPS");
            ((SSLSocket) socket).setSSLParameters(sslParams);
        }
        return socket;
    }

So lib crashed in line: sslParams.setEndpointIdentificationAlgorithm("HTTPS"); if app was launched on android api less than 24. Here is official docs: SSLParameters#setEndpointIdentificationAlgorithm(java.lang.String) Direct link to file in repo

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Hospescommented, Feb 12, 2017

Hi everyone again! I made fork of this repo and do some fixes for using this library on Android. Here is link to repo: aws-iot-device-sdk-android Also I published it to my public maven on bintray: Download

Feel free to use it! @fengsongAWS, also if I did something wrong or violate some license rules tell me, please. Thanks for this sdk!

0reactions
Ivan-Busanicommented, Nov 5, 2020

@Hospes you saved my life… Thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash on Android due to missing method ... - GitHub
Fatal Exception: java.lang.NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class ...
Read more >
Jetty WebsocketClient does not connect with SSL on android
NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters; or its super classes ...
Read more >
Getting this error java.lang.NoSuchMethodError: No ... - Medium
NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters; ...
Read more >
java.lang.NoSuchMethodError: No virtual method ...
java.lang.NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters ...
Read more >
No such method error setEndpointIdentificationAlgorithm
For our release 1.5.0 we had to update to Java API Version 1.7. Problem. Starting with release 1.5.0 we are using the method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found