我尝试连接到MQTT服务器,我在添加密码时遇到一些问题:
配置文件是:
mqtt:
clients:
client-ptl-mqtt:
serverUri: tcp://rdabeg01.inetpsa.com:1883
clientId: LOCAL_PTL_SIMUL_MQTT
connection:
userName: xxxxxx
password: xxxxxxx
reconnectionMode: ALWAYS
我尝试启动应用程序时的错误是:
org.seedstack.coffig.internal.ConfigurationException:[CONFIGURATION]非法转换
说明-----------无法转换为char(char.java:1):'xxxxxxx'。
堆栈跟踪
at org.seedstack.coffig.internal.ConfigurationException.createNew(ConfigurationException.java:30) at org.seedstack.coffig.mapper.ValueMapper.charOf(ValueMapper.java:63) at org.seedstack.coffig.mapper.ValueMapper.map(ValueMapper.java:51) at org.seedstack.coffig.mapper.CompositeMapper.map(CompositeMapper.java:50) at org.seedstack.coffig.mapper.EvaluatingMapper.map(EvaluatingMapper.java:65)`
SeedStack MQTT插件依赖于Paho,后者具有客户端连接MqttConnectOptions的配置类。密码字段需要一个char数组,插件不会改变。您的YAML相应修改:
mqtt:
clients:
client-ptl-mqtt:
serverUri: tcp://rdabeg01.inetpsa.com:1883
clientId: LOCAL_PTL_SIMUL_MQTT
connection:
userName: xxxxxx
password: [ 'p', 'a', 's', 's', 'w', 'o', 'r', 'd' ]
reconnectionMode: ALWAYS