我可以通过ActiveMQ代理发布和订阅消息,而无需使用SSL。
现在我想将ActiveMQ与SSL一起使用。我正在使用自签名证书。
我遵循了此链接中给出的步骤:http://activemq.apache.org/how-do-i-use-ssl.html 设置我的经纪人。
由于我必须在嵌入式设备上使用.pem格式的证书,因此我已将证书转换为.pem格式。
当我尝试将esp32 / MQTTfx(桌面应用程序)连接到代理 时,我从代理收到以下错误消息:
以下是我从MQTTfx收到的错误消息:
2020-06-15 12:10:14,037 | DEBUG | Transport Connection to: tcp://---.---.1.5:35182 failed: java.net.ProtocolException: Invalid message encoding | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///---.---.1.5:35182@1883
java.net.ProtocolException: Invalid message encoding
at org.fusesource.mqtt.codec.MessageSupport.readUTF(MessageSupport.java:63)[mqtt-client-1.12.jar:1.12]
at org.fusesource.mqtt.codec.CONNECT.decode(CONNECT.java:79)[mqtt-client-1.12.jar:1.12]
at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(MQTTProtocolConverter.java:200)[activemq-mqtt-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.mqtt.MQTTTransportFilter.onCommand(MQTTTransportFilter.java:94)[activemq-mqtt-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)[activemq-client-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233)[activemq-client-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)[activemq-client-5.13.0.jar:5.13.0]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_92]
2020-06-15 12:10:14,040 | DEBUG | Unregistering MBean org.apache.activemq:type=Broker,brokerName=localhost,connector=clientConnectors,connectorName=mqtt,connectionViewType=remoteAddress,connectionName=tcp_//---.---.1.5_35182 | org.apache.activemq.broker.jmx.ManagementContext | ActiveMQ Transport: tcp:///---.---.1.5:35182@1883
2020-06-15 12:10:14,041 | DEBUG | Stopping connection: tcp://---.---.1.5:35182 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[localhost] Task-2185
2020-06-15 12:10:14,041 | WARN | Exception occurred processing:
MQTTFrame { type: unknown, qos: AT_MOST_ONCE, dup:false }: org.apache.activemq.transport.mqtt.MQTTProtocolException: Unknown MQTTFrame type: 0 | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | ActiveMQ Transport: tcp:///---.---.1.5:35182@1883
2020-06-15 12:10:14,042 | DEBUG | Exception detail | org.apache.activemq.transport.mqtt.MQTTProtocolConverter | ActiveMQ Transport: tcp:///---.---.1.5:35182@1883
org.apache.activemq.transport.mqtt.MQTTProtocolException: Unknown MQTTFrame type: 0
at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(MQTTProtocolConverter.java:230)[activemq-mqtt-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.mqtt.MQTTTransportFilter.onCommand(MQTTTransportFilter.java:94)[activemq-mqtt-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)[activemq-client-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233)[activemq-client-5.13.0.jar:5.13.0]
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)[activemq-client-5.13.0.jar:5.13.0]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_92]
2020-06-15 12:10:14,042 | DEBUG | Stopping transport tcp:///---.---.1.5:35182@1883 | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ BrokerService[localhost] Task-2185
2020-06-15 12:10:14,045 | DEBUG | Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: java.util.concurrent.ThreadPoolExecutor@384c5a21[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[localhost] Task-2185
2020-06-15 12:10:14,047 | DEBUG | Closed socket Socket[addr=/---.---.1.5,port=35182,localport=1883] | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ Task-1
2020-06-15 12:10:14,049 | DEBUG | Forcing shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@384c5a21[Running, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 1] | org.apache.activemq.util.ThreadPoolUtils | ActiveMQ BrokerService[localhost] Task-2185
2020-06-15 12:10:14,054 | DEBUG | Stopped transport: tcp://---.---.1.5:35182 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[localhost] Task-2185
2020-06-15 12:10:14,056 | DEBUG | Connection Stopped: tcp://---.---.1.5:35182 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[localhost] Task-2185
在代理和客户端上都使用MQTT 3.1.1版本。
那我想念的是什么? 任何帮助,将不胜感激。 谢谢。
答案 0 :(得分:0)
只需关闭此循环即可。用户试图从TCP连接连接到SSL连接,或者试图从SSL连接到代理上的TCP接受端口,由于二进制有效负载的内容无法解码为有效协议,导致该消息发出类型。
连接到正确的端口可以解决此问题。