我的配置有什么问题? AWS - 使用MQTT的物联网

时间:2015-11-10 08:59:21

标签: amazon-web-services mqtt iot

我正在关注亚马逊网络服务IoT的开发者指南,但我遇到了一些初学者问题,我不知道如何解决这些问题。我坐了两天。这就是发生的事情(我正在使用mac):

第一个问题: 在本指南中:http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html 我可以通过在终端中调用“$ was configure”来查看和编辑我的个人资料。如果我调用“ls~ / .aws”,我可以看到config和credentials文件夹。但是,如果我打电话:“〜/ .aws / credentials”或“〜/ .aws / config”,我收到以下错误:-bash:/Users/christopher/.aws/credentials:权限被拒绝。 如果我在finder中搜索,则找不到文件名aws。

第二个问题: 在指南的下一页,编号为11.我无法将点变为绿色,因为当我按连接时出现错误。 MQTT.fx工具表示它无法在Log中找到rootCA.pem文件。像这样:

2015-11-10 09:55:48,330  INFO --- ScriptsController              : Clear console.
2015-11-10 09:55:48,332  INFO --- MqttFX ClientModel             : MqttClient with ID fc47354d17e84b6c8507eb1accb61560 assigned.
2015-11-10 09:55:48,340 ERROR --- MqttFX ClientModel             : Error when connecting
java.io.FileNotFoundException: rootCA.pem (No such file or directory)
    at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_60]
    at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_60]
    at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_60]
    at java.io.FileInputStream.<init>(FileInputStream.java:93) ~[?:1.8.0_60]
    at de.jensd.mqttfx.ssl.SSLFellow.loadX509CertificatePem(SSLFellow.java:173) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.ssl.SSLFellow.createSSLSocketFactory(SSLFellow.java:51) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.model.MqttFXClientModel.getMqttConnectOptions(MqttFXClientModel.java:713) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.model.MqttFXClientModel.connect(MqttFXClientModel.java:420) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.services.BrokerConnectService$1.call(BrokerConnectService.java:68) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.services.BrokerConnectService$1.call(BrokerConnectService.java:65) ~[MQTT.fx-jfx.jar:?]
    at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) ~[jfxrt.jar:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_60]
    at javafx.concurrent.Service.lambda$null$493(Service.java:725) ~[jfxrt.jar:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
    at javafx.concurrent.Service.lambda$executeTask$494(Service.java:724) ~[jfxrt.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
2015-11-10 09:55:48,563  INFO --- ScriptsController              : Clear console.
2015-11-10 09:55:48,563 ERROR --- BrokerConnectService           : FileNotFoundException: rootCA.pem (No such file or directory)

当我点击证书旁边的“...”按钮时,我注意到两件事。 1.这里的证书是在我的用户文件夹中创建的,而不是在aws中创建的?配置文件夹。 2.未创建rootCA.pem证书。

我按照本教程签署了自己的rootCA.pem证书:http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/

然后在MQTT.fx工具中,我再次按下每个证书旁边的“...”按钮,手动选择每个证书。显示每个路径,如下所示:/Users/christopher/cert.pem

当我再次尝试连接时,我在MQTT.fx工具中收到以下错误:

2015-11-09 17:00:30,634  INFO --- ScriptsController              : Clear console.
2015-11-09 17:00:30,635 ERROR --- BrokerConnectService           : NullPointerException: null
2015-11-09 17:43:17,544  INFO --- BrokerConnectorController      : onConnect
2015-11-09 17:43:17,592  INFO --- ScriptsController              : Clear console.
2015-11-09 17:43:17,595  INFO --- MqttFX ClientModel             : MqttClient with ID fc47354d17e84b6c8507eb1accb61560 assigned.
2015-11-09 17:43:17,661 ERROR --- MqttFX ClientModel             : Error when connecting
java.lang.NullPointerException
    at de.jensd.mqttfx.ssl.SSLFellow.loadPem(SSLFellow.java:221) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.ssl.SSLFellow.loadPrivateKeyPem(SSLFellow.java:184) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.ssl.SSLFellow.createSSLSocketFactory(SSLFellow.java:55) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.model.MqttFXClientModel.getMqttConnectOptions(MqttFXClientModel.java:713) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.model.MqttFXClientModel.connect(MqttFXClientModel.java:420) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.services.BrokerConnectService$1.call(BrokerConnectService.java:68) ~[MQTT.fx-jfx.jar:?]
    at de.jensd.mqttfx.services.BrokerConnectService$1.call(BrokerConnectService.java:65) ~[MQTT.fx-jfx.jar:?]
    at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) ~[jfxrt.jar:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_60]
    at javafx.concurrent.Service.lambda$null$493(Service.java:725) ~[jfxrt.jar:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
    at javafx.concurrent.Service.lambda$executeTask$494(Service.java:724) ~[jfxrt.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
2015-11-09 17:43:18,472  INFO --- ScriptsController              : Clear console.
2015-11-09 17:43:18,473 ERROR --- BrokerConnectService           : NullPointerException: null

我可以在aws IoT网站(控制台上)看到证书,政策和灯泡都像教程一样连接起来。但其余的都是个谜。 我会很高兴能得到所有帮助。谢谢!

2 个答案:

答案 0 :(得分:1)

  1. 使用自己的域名时,必须签署自己的CA.可以在http://docs.aws.amazon.com/iot/latest/developerguide/verify-pub-sub.html
  2. 找到原始根证书的位置

答案 1 :(得分:0)

根CA证书不是为您创建的,而是在AWS IoT文档中的某处链接,并且对所有人都是相同的。

请参阅此处的第一个附录: http://docs.aws.amazon.com/iot/latest/developerguide/verify-pub-sub.html

是根CA: https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem