Open lexguy20 opened 4 years ago
Can you simplify the repro so that it doesn't reference the device client library you mentioned? This repo is for Paho, not the Azure IoT SDK. Here is some simple code for opening an MQTT websocket connection directly using Paho:
String broker = "wss://iot.eclipse.org:443";
String clientId = "JavaSample";
MemoryPersistence persistence = new MemoryPersistence();
try {
MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
sampleClient.setCallback(new MqttCallback()
{
@Override
public void connectionLost(Throwable cause) {
System.out.println("Lost connection");
cause.printStackTrace();
}
@Override
public void messageArrived(String topic, MqttMessage message) throws Exception {
}
@Override
public void deliveryComplete(IMqttDeliveryToken token) {
}
});
System.out.println("Connecting to broker: "+broker);
sampleClient.connect();
System.out.println("Connected");
} catch(MqttException me) {
me.printStackTrace();
}
Is your device capable of running the above without hitting an exception?
Hi, I upgraded DeviceClient to 1.18.0 with all its dependencies and now I am getting following IllegalArgumentException while creating DeviceClient, if I keep the DeviceClient version 1.16.0, I don't see following exception:
java.lang.IllegalArgumentException: no NetworkModule installed for scheme "wss" of URI "wss://dev-lram-iot.azure-devices.net/$iothub/websocket?iothub-no-client-cert=true"java.lang.IllegalArgumentException: no NetworkModule installed for scheme "wss" of URI "wss://dev-lram-iot.azure-devices.net/$iothub/websocket?iothub-no-client-cert=true" at org.eclipse.paho.client.mqttv3.internal.NetworkModuleService.validateURI(NetworkModuleService.java:72) at org.eclipse.paho.client.mqttv3.internal.NetworkModuleService.validateURI(NetworkModuleService.java:72) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:454) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:454)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:320) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:320)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:315) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.(MqttAsyncClient.java:315)
at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttConnection.(MqttConnection.java:65) at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttConnection.(MqttConnection.java:65)
at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttIotHubConnection.open(MqttIotHubConnection.java:171) at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttIotHubConnection.open(MqttIotHubConnection.java:171)
at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.openConnection(IotHubTransport.java:707) at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.openConnection(IotHubTransport.java:707)
at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.open(IotHubTransport.java:273) at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.open(IotHubTransport.java:273)
at com.microsoft.azure.sdk.iot.device.DeviceIO.open(DeviceIO.java:158) at com.microsoft.azure.sdk.iot.device.DeviceIO.open(DeviceIO.java:158)
at com.microsoft.azure.sdk.iot.device.InternalClient.open(InternalClient.java:123) at com.microsoft.azure.sdk.iot.device.InternalClient.open(InternalClient.java:123)
at com.microsoft.azure.sdk.iot.device.DeviceClient.open(DeviceClient.java:316) at com.microsoft.azure.sdk.iot.device.DeviceClient.open(DeviceClient.java:316)
Any help will be greatly appreciated, thanks Here is my code:
}`