robocup-logistics / rcll-mqtt-bridge

0 stars 0 forks source link

Unabel to launch mqtt-bridge #3

Open Unknown-Student opened 5 months ago

Unknown-Student commented 5 months ago

Hello,

I want to use the mqtt-bridge in combination with the rcll-refbox and rcll-refbox-frontend to record some messages. However I can't get it to work.

Since I installed the mqtt-bridge via docker from docker pull ghcr.io/robocup-logistics/rcll-mqtt-bridge:master and tried to run it with docker run quay.io/robocup-logistics/rcll-mqt-bridge. I then get this error:

WARNING: Illegal reflective access by org.eclipse.paho.client.mqttv3.internal.FileLock (file:/home/gradle/src/app/build/libs/mqtt-bridge-0.3-all.jar) to method sun.nio.ch.FileLockImpl.release()
WARNING: Please consider reporting this to the maintainers of org.eclipse.paho.client.mqttv3.internal.FileLock
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" Unable to connect to server (32103) - java.net.ConnectException: Connection refused (Connection refused)
    at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:80)
    at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:724)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.base/java.net.Socket.connect(Socket.java:609)
    at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:74)
    ... 2 more

I also can't build it by cloning the repo and building the Dockerfile, then the build fails at => ERROR [4/4] RUN gradle build --no-daemon

I also tried to install the mqtt-bridge directly, but I only get this error message Error: Unable to access jarfile mqtt-bridge-0.1-all.jar What is this jar file and where should it be?

How do I correctly install and run the mqtt-bridge, preferably with docker?

I appreciate any help. Thank you

pkohout commented 4 months ago

Hi, sorry for my delayed answer. It seems that the broker is not running, or at least not reachable for the bridge, you sure it was running? I updated the code to print a proper error msg if that happens. What is the value for you broker and how do you start the container? Is it running in network mode host? A good tool to check if your mqtt broker is running is: http://mqtt-explorer.com/, which can be used to observe what is published on it.

The error you get on gradle just says that it is not running, is it installed on your system? The jar file can be found in app/build/lib. But I highly recommend to use docker to run it.

Unknown-Student commented 4 months ago

Thank you for your answer! The broker was in fact not running. I reinstalled the mqtt-bridge using the rcll-get-started repo. I can now reach the broker with the mqtt-explorer, the refbox and the front-end are also started. I'm just not sure if I reach the right broker?

Screenshot from 2024-05-15 15-53-04

When I start the refbox with rc_start I can reach the broker with mqtt-explorer and when I stop it with rc_stop I lose connection, but the messages are different from the ones I see in the mqtt-bridge repo. ie. I don't get the private and public messages.

Screenshot from 2024-05-15 15-54-00

My local_shell.sh file

export RC_MQTT_START=true
export RC_MQTT_BROKER_START=true
export RC_MQTT_BROKER=tcp://localhost:1892
export RC_MQTT_REFBOX=localhost
export RC_MQTT_TEAM=GRIPS
export RC_MQTT_KEY=randomkey

export REFBOX_CONFIG_CHALLENGE=./../config/refbox/challenge_prod_c0.yaml

Output of rc_start:

Starting mqtt_broker
WARNING: Found orphan containers (compose_files_mqtt_1, refbox, mongodb, compose_files_mongodb-check_1, refbox-frontend) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting compose_files_broker_1 ... done
bash: [: -ne: unary operator expected
0 bash
Setting up screen tab mqtt_broker
Starting mongodb
WARNING: Found orphan containers (refbox, compose_files_broker_1, compose_files_mongodb-check_1, compose_files_mqtt_1, refbox-frontend) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting mongodb ... done
bash: [: -ne: unary operator expected
0 bash 1 mqtt_broker
Setting up screen tab mongodb
Check Mongodb Connectivity on mongodb://localhost:27017 and start Refbox
Starting refbox
WARNING: Found orphan containers (compose_files_broker_1, mongodb, compose_files_mqtt_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting compose_files_mongodb-check_1 ... done
Starting refbox-frontend               ... done
Starting refbox                        ... done
bash: [: -ne: unary operator expected
0 bash 1 mqtt_broker 2 mongodb
Setting up screen tab refbox
Starting mqtt_bridge
WARNING: Found orphan containers (refbox-frontend, compose_files_broker_1, compose_files_mongodb-check_1, mongodb, refbox) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating compose_files_mqtt_1 ... done
bash: [: -ne: unary operator expected
0 bash 1 mqtt_broker 2 mongodb 3 refbox
Setting up screen tab mqtt_bridge

I'm using MQTT and the RCLL repo for the first time and I'm trying to wrap my head around all of it. Thanks for the help.