订阅客户端上下线消息报错

环境信息

  • EMQX 版本:5.08
  • 操作系统及版本:
  • 其他

问题描述

配置文件及日志

主要代码如下
 String subTopic2=  "$SYS/brokers/emqx@172.18.124.44/clients/05836b36-27e19820_1666484338/connected";
	client.subscribe(subTopic2, 1);

下面日志错误**

msg MqttException

loc MqttException

cause null

excep MqttException (128)

MqttException (128)

at org.eclipse.paho.client.mqttv3.MqttClient.subscribe(MqttClient.java:466)

at org.eclipse.paho.client.mqttv3.MqttClient.subscribe(MqttClient.java:429)

at org.eclipse.paho.client.mqttv3.MqttClient.subscribe(MqttClient.java:422)

at com.rrht.webservice.camera.mqtt.MqttClientTest.main(MqttClientTest.java:337)

ACL规则默认里面只允许127.0.0.1订阅sys主题的。

{allow, {username, "dashboard"}, subscribe, ["$SYS/#"]}.
{allow, {ipaddr, "127.0.0.1"}, all, ["$SYS/#", "#"]}.
{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.

检查下你改了没。