2

我尝试连接到 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.cofig.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)`
4

1 回答 1

1

SeedStack MQTT 插件依赖于 Paho,它有一个用于客户端连接MqttConnectOptions的配置类。密码字段需要一个字符数组,插件不会改变它。您的 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
于 2018-09-17T09:23:10.400 回答