MQTT.fx 是一款基于 Eclipse Paho 使用 Java 语言编写的 MQTT 客户端,支持 Windows、Mac 和 Linux 操作系统,可用于验证设备是否可与物联网平台正常连接,并通过 Topic 订阅和发布消息。
image.png
问题
在使用 MQTT.fx 的 TLS 功能,当以前配置的证书路径已经不存在时,你点击 ... 选择证书时将会出 bug
Caused by: java.lang.IllegalArgumentException: Folder parameter must be a valid folder
at com.sun.glass.ui.CommonDialogs.convertFolder(CommonDialogs.java:238)
at com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:190)
at com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1503)
at javafx.stage.FileChooser.showDialog(FileChooser.java:416)
at javafx.stage.FileChooser.showOpenDialog(FileChooser.java:350)
at de.jensd.mqttfx.ui.profileeditor.ConnectionProfilesEditorController.selectFile(ConnectionProfilesEditorController.java:855)
at de.jensd.mqttfx.ui.profileeditor.ConnectionProfilesEditorController.onSelectSelfCreatedCA(ConnectionProfilesEditorController.java:797)
... 74 more
解决办法
方法一(不推荐)
删除 mqttfx-config.xml 文件,重新打开 MQTT.fx,会生成正确数据的 mqttfx-config.xml。
mqttfx-config.xml 中保存的是 MQTT Connection Profile 信息,若删除,则需要重新配置你的 MQTT Connection Profile
方法二(推荐)
打开 mqttfx-config.xml,将 lastChoosenDirectory 节点的值改为一个存在的路径即可
image.png
mqttfx-config.xml 目录
Windows
[USER_HOME]\AppData\Local\MQTT-FX
Mac OSX
[USER_HOME]/Library/Application Support/MQTT-FX
Linux
[USER_HOME]/MQTT-FX