0

我正在关注 Azure IoT 示例(https://docs.microsoft.com/en-us/azure/iot-hub/quickstart-send-telemetry-java)将数据从设备发送到 IoTHUb 但出现以下错误:

  SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.io.IOException: Could not open the connection
        at com.microsoft.azure.sdk.iot.device.DeviceIO.open(DeviceIO.java:164)
        at com.microsoft.azure.sdk.iot.device.InternalClient.open(InternalClient.java:130)
        at com.microsoft.azure.sdk.iot.device.DeviceClient.open(DeviceClient.java:317)
        at com.microsoft.docs.iothub.samples.SimulatedDevice.main(SimulatedDevice.java:157)
Caused by: com.microsoft.azure.sdk.iot.device.exceptions.ProtocolException: Unable to establish MQTT connection
        at com.microsoft.azure.sdk.iot.device.transport.mqtt.exceptions.PahoExceptionTranslator.convertToMqttException(PahoExceptionTranslator.java:40)
        at com.microsoft.azure.sdk.iot.device.transport.mqtt.Mqtt.connect(Mqtt.java:125)
        at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttMessaging.start(MqttMessaging.java:56)
        at com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttIotHubConnection.open(MqttIotHubConnection.java:180)
        at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.openConnection(IotHubTransport.java:653)
        at com.microsoft.azure.sdk.iot.device.transport.IotHubTransport.open(IotHubTransport.java:280)
        at com.microsoft.azure.sdk.iot.device.DeviceIO.open(DeviceIO.java:160)
        ... 3 more
Caused by: MqttException (0) - java.net.UnknownHostException: XXXIOTHUB.azure-devices.net
        at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
        at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:715)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: XXXIOTHUB.azure-devices.net
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:80)
        at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule.java:103)
        at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:701)
        ... 7 more

我对 XXXIOTHUB.azure-devices.net 执行了 ping 操作,但无法从我的本地计算机访问它。我需要配置任何队列吗?或者如何使它可用于我的设备

4

0 回答 0