[SOLVED] Can't configure 8883 port

  • Platform information:
    • Hardware: raspberrypi 4

    • OS: what OS is used and which version
      openjdk version “1.8.0_222”
      OpenJDK Runtime Environment (Zulu8.40.0.178-CA-linux_aarch32hf) (build 1.8.0_222-b178)
      OpenJDK Client VM (Zulu8.40.0.178-CA-linux_aarch32hf) (build 25.222-b178, mixed mode, Evaluation)

    • openHAB version: openHAB 2.5.8-1

Hello,
So i setup the SSL with Let’s encrypt and i wanted to change the port to 8883. made the changes in Paper UI and mqtt.cfg but know i have this error.

  • Log files:

2020-09-16 23:51:28.983 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.

2020-09-16 23:51:28.986 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘iceycookie’

2020-09-16 23:51:29.018 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection

org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server

at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79) ~[?:?]

at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule.java:86) ~[?:?]

at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) ~[?:?]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Caused by: java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_222]

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_222]

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_222]

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_222]

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_222]

at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_222]

at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666) ~[?:1.8.0_222]

at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[?:?]

… 3 more

2020-09-16 23:51:53.675 [hingStatusInfoChangedEvent] - ‘mqtt:broker:f075cba4’ changed from UNINITIALIZED (HANDLER_INITIALIZING_ERROR): java.security.NoSuchAlgorithmException: Algorithm is missing to INITIALIZING

I really don’t know what to do with it…
If i public the 1883…it’s all good…but when i do this…buf…:))

Did you have this error?

You didn’t include your configuration, so no one can tell what you did wrong.

But the error I quoted above would appear to indicate that whatever you’re trying to connect to is not configured to be connected to.

1 Like

ah, sorry…
I want to configure mqtt broker to 8883 port.


i did like in the example here but with Secure connection

i found the solution…GOD!

Created the certs form the tutorial below:
http://www.steves-internet-guide.com/mosquitto-tls/

after the certs were created you need to make this moves:

  1. sudo cp ca.crt /etc/mosquitto/certs

  2. sudo cp server.crt /etc/mosquitto/certs

  3. sudo cp server.key /etc/mosquitto/certs

after that i edited the

/etc/mosquitto/mosquitto.conf

Added the following lines:

listener 8883
cafile /etc/mosquitto/certs/ca.crt
certfile /etc/mosquitto/certs/server.crt
keyfile /etc/mosquitto/certs/server.key
require_certificate false

in the final act i restarted the mosquitto

sudo systemctl restart mosquitto

And in the openhab i configured the Broker with 8883 port

i have an free DNS from internet provider so i didn’t use any free DNS