aws / aws-iot-device-sdk-java

Java SDK for connecting to AWS IoT from a device.
https://aws.amazon.com/iot/sdk/
Apache License 2.0
211 stars 167 forks source link

Connect fails org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1 #23

Closed jpvirolainen closed 7 years ago

jpvirolainen commented 7 years ago

Today suddenly AWSIotMqttClient::connect started failing with: com.amazonaws.services.iot.client.AWSIotException: null at com.amazonaws.services.iot.client.core.AwsIotCompletion.get(AwsIotCompletion.java:213) ~[hdm-push-server-1.3.1-standalone.jar:1.3.1] at com.amazonaws.services.iot.client.core.AbstractAwsIotClient.connect(AbstractAwsIotClient.java:112) ~[hdm-push-server-1.3.1-standalone.jar:1.3.1] at com.amazonaws.services.iot.client.AWSIotMqttClient.connect(AWSIotMqttClient.java:501) ~[hdm-push-server-1.3.1-standalone.jar:1.3.1] at com.amazonaws.services.iot.client.core.AbstractAwsIotClient.connect(AbstractAwsIotClient.java:93) ~[hdm-push-server-1.3.1-standalone.jar:1.3.1] at com.amazonaws.services.iot.client.AWSIotMqttClient.connect(AWSIotMqttClient.java:463) ~[hdm-push-server-1.3.1-standalone.jar:1.3.1]

It seems org.eclipse.paho.client.mqttv3 got upgraded from 1.1.0 to 1.1.1. When forced back to 1.1.0 the connection works again

fengsongAWS commented 7 years ago

Hi @jpvirolainen , We are aware of this issue and this is an error thrown by paho mqtt v1.1.1. This error seems to be related to the changes they made in this function: https://github.com/eclipse/paho.mqtt.java/blob/562593c35d6079bc55dc60cabdcb81cea30f4d7b/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/websocket/WebSocketHandshake.java#L83

Please revert back to v1.1.0 for now and we will work on this in the future release.

Thanks

knechtandreas commented 7 years ago

Found out that my issue over here (https://forums.aws.amazon.com/thread.jspa?messageID=775065) was also caused by this... downgrading fixed the problem.

knechtandreas commented 7 years ago

For gradle this did the trick:

compile('com.amazonaws:aws-iot-device-sdk-java:1.0.1') {
exclude group: 'org.eclipse.paho', module: 'org.eclipse.paho.client.mqttv3'
}
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
fengsongAWS commented 7 years ago

Hi,

Thanks for the suggestions. We have Java SDK v1.1.0 which explicitly depends on paho v1.1.0 so it will not pull down the latest paho.

Thanks again for your interest in AWS IoT Device SDK.

Typhlosaurus commented 7 years ago

@knechtandreas this may be a simpler change to your gradle:

dependencies {
    // mqttv3 1.1.1 fails to connect for unknown reasons
    compile (group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.1.0'){force = true}
    compile 'com.amazonaws:aws-iot-device-sdk-java:1.1.0'
    ...

Also see: https://github.com/eclipse/paho.mqtt.java/issues/345