简体   繁体   English

MQTT.fx 无法连接到 AWS IoT (MqttException)

[英]MQTT.fx can't connect to AWS IoT (MqttException)

I am trying to follow this tutorial https://circuitdigest.com/tutorial/getting-started-with-amazon-aws-for-iot-projects我正在尝试按照本教程https://circuitdigest.com/tutorial/getting-started-with-amazon-aws-for-iot-projects

I did the all steps again and again but I can't get rid of MqttException error when click on "Connect" button in MQTT.fx.我一次又一次地执行了所有步骤,但是在单击 MQTT.fx 中的“连接”按钮时我无法摆脱 MqttException 错误。

I download the certificates from AWS IoT and keep them in C:\temp folder.我从 AWS IoT 下载证书并将它们保存在 C:\temp 文件夹中。 I also checked log tab in MQTT.fx here you can see that below.我还检查了 MQTT.fx 中的日志选项卡,您可以在下面看到。 Do you have any idea about how to solve it?你知道如何解决它吗?

Thanks a lot!非常感谢!

2020-10-09 10:40:28,043 ERROR --- MqttFX ClientModel: Please verify your Settings (eg Broker Address, Broker Port & Client ID) and the user credentials. 2020-10-09 10:40:28,043 错误 --- MqttFX ClientModel:请验证您的设置(例如经纪人地址、经纪人端口和客户端 ID)和用户凭据。 org.eclipse.paho.client.mqttv3:MqttException. org.eclipse.paho.client.mqttv3:MqttException。 MqttException at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper:java.38) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.715) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at java.util.concurrent.Executors$RunnableAdapter?call(Unknown Source) ~[:.1.8.0_162] at java.util.concurrent.FutureTask?run(Unknown Source) ~[:.1.8.0_162] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask?access$201(Unknown Source) ~[:.1.8.0_162] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask?run(Unknown Source) ~[:.1.8.0_162] at java.util.concurrent.ThreadPoolExecutor?runWorker(Unknown Source) [:.1.8.0_162] at java.util.concurrent.ThreadPoolExecutor$Worker?run(Unknown Source) [:.1.8.0_162] at java.lang.Th MqttException at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper:java.38) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client .mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.715) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] 在 java? ) ~[:.1.8.0_162] 在 java.util.concurrent.FutureTask?run(Unknown Source)~[:.1.8.0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask?access$201(Unknown Source)~[ :.1.8.0_162] 在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask?run(Unknown Source) ~[:.1.8.0_162] 在 java.util.concurrent.ThreadPoolExecutor?runWorker(Unknown Source) [:.1.28.0_162] ] 在 java.util.concurrent.ThreadPoolExecutor$Worker?run(Unknown Source) [:.1.8.0_162] 在 java.lang.Th read?run(Unknown Source) [:.1.8:0_162] Caused by. read?run(Unknown Source) [:.1.8:0_162] 引起的。 javax.net.ssl:SSLHandshakeException. javax.net.ssl:SSLHandshakeException。 sun.security.validator:ValidatorException: PKIX path building failed. sun.security.validator:ValidatorException: PKIX 路径构建失败。 sun.security.provider.certpath:SunCertPathBuilderException. sun.security.provider.certpath:SunCertPathBuilderException。 unable to find valid certification path to requested target at sun.security.ssl.Alerts?getSSLException(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?fatal(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?fatalSE(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?fatalSE(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?serverCertificate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?processMessage(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?processLoop(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?process_record(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?readRecord(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?performInitialHandshake(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(无法在 sun.security.ssl.Alerts?getSSLException(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?fatal(Unknown Source) ~[:.1.8] 找到到请求目标的有效证书路径.0_162] 在 sun.security.ssl.Handshaker?fatalSE(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.Handshaker?fatalSE(未知来源)~[:.1.8.0_162] 在 sun。 security.ssl.ClientHandshaker?serverCertificate(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.ClientHandshaker?processMessage(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.Handshaker? processLoop(未知来源)~[:.1.8.0_162] at sun.security.ssl.Handshaker?process_record(未知来源)~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?readRecord(未知来源)~ [:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?performInitialHandshake(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake( Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(Unknown Source) ~[:.1.8.0_162] at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule:java.108) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.701) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.]..: 7 more Caused by.未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake(未知来源)~[:.1.8.0_162] 在 org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start( SSLNetworkModule:java.108) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.701) ~[org .eclipse.paho.client.mqttv3-1.2.0:jar?..: 7 更多由.引起。 sun.security.validator:ValidatorException: PKIX path building failed. sun.security.validator:ValidatorException: PKIX 路径构建失败。 sun.security.provider.certpath:SunCertPathBuilderException. sun.security.provider.certpath:SunCertPathBuilderException。 unable to find valid certification path to requested target at sun.security.validator.PKIXValidator?doBuild(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.PKIXValidator?engineValidate(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.Validator?validate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?validate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?checkTrusted(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?checkServerTrusted(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?serverCertificate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?processMessage(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?processLoop(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?process_record(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?无法在 sun.security.validator.PKIXValidator?doBuild(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.PKIXValidator?engineValidate(Unknown Source) ~[:.1.8 找到到所请求目标的有效认证路径.0_162] 在 sun.security.validator.Validator?validate(Unknown Source) ~[:.1.8.0_162] 在 sun.security.ssl.X509TrustManagerImpl?validate(Unknown Source) ~[:.1.8.0_162] 在 sun。 security.ssl.X509TrustManagerImpl?checkTrusted(来源未知)~[:.1.8.0_162] 在 sun.security.ssl.X509TrustManagerImpl?checkServerTrusted(来源未知)~[:.1.8.0_162] 在 sun.security.8839237735ClientHandshaker? serverCertificate(未知来源)~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?processMessage(未知来源)~[:.1.8.0_162] at sun.security.ssl.Handshaker?processLoop(未知来源)~ [:.1.8.0_162] 在 sun.security.ssl.Handshaker?process_record(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl? readRecord(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?performInitialHandshake(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(Unknown Source) ~[:.1.8.0_162] at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule:java.108) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.701) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.]..: 7 more Caused by. readRecord(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?performInitialHandshake(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake(未知来源)~ [:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake(未知来源)~[:.1.8.0_162] 在 org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule:882538284691408) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] 在 org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java8[7.681] .client.mqttv3-1.2.0:jar?..: 7 更多由.引起。 sun.security.provider.certpath:SunCertPathBuilderException. sun.security.provider.certpath:SunCertPathBuilderException。 unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder?build(Unknown Source) ~[:.1.8.0_162] at sun.security.provider.certpath.SunCertPathBuilder?engineBuild(Unknown Source) ~[:.1.8.0_162] at java.security.cert.CertPathBuilder?build(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.PKIXValidator?doBuild(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.PKIXValidator?engineValidate(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.Validator?validate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?validate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?checkTrusted(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?checkServerTrusted(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHandshaker?serverCertificate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.ClientHand无法在 sun.security.provider.certpath.SunCertPathBuilder?build(Unknown Source) ~[:.1.8.0_162] at sun.security.provider.certpath.SunCertPathBuilder?engineBuild(Unknown Source) 找到到所请求目标的有效证书路径~ [:.1.8.0_162] at java.security.cert.CertPathBuilder?build(Unknown Source) ~[:.1.8.0_162] at sun.security.validator.PKIXValidator?doBuild(Unknown Source) ~[:.1.8.0_162 ] 在 sun.security.validator.PKIXValidator?engineValidate(Unknown Source) ~[:.1.8.0_162] 在 sun.security.validator.Validator?validate(Unknown Source) ~[:.1.8.0_162] 在 sun.security。 ssl.X509TrustManagerImpl?validate(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509TrustManagerImpl?checkTrusted(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.X509?来源不明)~[:.1.8.0_162] 在 sun.security.ssl.ClientHandshaker?serverCertificate(来源不明)~[:.1.8.0_162] 在 sun.security.ssl.ClientHand shaker?processMessage(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?processLoop(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.Handshaker?process_record(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?readRecord(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?performInitialHandshake(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(Unknown Source) ~[:.1.8.0_162] at sun.security.ssl.SSLSocketImpl?startHandshake(Unknown Source) ~[:.1.8.0_162] at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule:java.108) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms:java.701) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.]..: 7 more 2020-10-09 10:40,28:045 INFO --- ScriptsControlle摇床?processMessage(未知来源)〜[:.1.8.0_162] at sun.security.ssl.Handshaker?processLoop(未知来源)〜[:.1.8.0_162] at sun.security.ssl.Handshaker?process_record(未知来源) ~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?readRecord(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?performInitialHandshake(未知来源)~[:.1.8 .0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake(未知来源)~[:.1.8.0_162] 在 sun.security.ssl.SSLSocketImpl?startHandshake(未知来源)~[:.1.8.0_162] 在 org. eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule:java.108) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?.] at org.eclipse.paho.client.mqttv3.internal .ClientComms$ConnectBG.run(ClientComms:java.701) ~[org.eclipse.paho.client.mqttv3-1.2.0:jar?..: 7 more 2020-10-09 10:40,28:045 信息 - -- 脚本控件r.Clear console: 2020-10-09 10:40,28:046 ERROR --- BrokerConnectService : MqttException清除控制台:2020-10-09 10:40,28:046 错误 --- BrokerConnectService:MqttException

I solved my problem.我解决了我的问题。 It was about downloading the wrong certificate.这是关于下载错误的证书。 You can find detailed solution here.您可以在此处找到详细的解决方案。

After you create a thing in AWS IoT, download all the 3 certificates.在 AWS IoT 中创建事物后,下载所有 3 个证书。

If you want to get the CA certificate which is necessary for MQTT.fx you need to go here (you will see this link under the download certificates section in AWS IoT after you create your thing) and click on RSA 2048 bit key: Amazon Root CA 1 link.如果您想获得 MQTT.fx 所需的 CA 证书,您需要在此处输入 go(创建您的东西后,您将在 AWS IoT 的下载证书部分下看到此链接)并单击RSA 2048 位密钥:Amazon Root CA 1链接。 New tab will be open.新标签页将打开。

Copy and paste this certificate to your notepad.将此证书复制并粘贴到您的记事本中。 Name it Amazon_Root_CA_1.pem and select All File types when you are saving it.保存时将其命名为 Amazon_Root_CA_1.pem 和 select 所有文件类型。

Put all the certificates in one file.将所有证书放在一个文件中。 I keep them under C:\temp folder.我将它们保存在 C:\temp 文件夹下。

And finally, this is how my configuration looks like: MQTT.fx configuration最后,这就是我的配置: MQTT.fx 配置

Now MQTT.fx will work hopefully:)现在 MQTT.fx 有望正常工作:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM