I am getting the connection failure error when i tried to connect
from Local Docker ( simple application Spring cloud - Function Processor) to solace Localhost.
I checked the /etc/hosts in my Mac and see that it is correctly mapped for localhost.
Please note that before deploying to docker, same application works fine in my eclipse as spring boot app.
Error details:
021-09-07 03:20:56.969 INFO 1 — [ main] c.s.j.protocol.impl.TcpClientChannel : Connection attempt failed to host ‘localhost’ ConnectException com.solacesystems.jcsmp.JCSMPTransportException: (Client name: e6f94322ff6a/1/#00120001/CBzOqDQrGK Local port: -1 Remote addr: localhost Remote port: 55555) - Error communicating with the router. cause: java.net.ConnectException: Connection refused ((Client name: e6f94322ff6a/1/#00120001/CBzOqDQrGK Local port: -1 Remote addr: localhost Remote port: 55555) - )
2021-09-07 03:20:59.971 INFO 1 — [ main] c.s.j.protocol.impl.TcpClientChannel : Connecting to host ‘orig=localhost, host=localhost’ (host 1 of 1, smfclient 1, attempt 1 of 1, this_host_attempt: 13 o
If your app is inside a docker container and your Solace event broker are running locally, then you can’t use localhost to access the broker from within your container. Localhost simply refers to the container itself, not your laptop/host. When the app is running locally via IDE or via command line as Spring boot app, the app is able to access the broker since the broker container should have exposed the ports to your local OS (the -p 55555:55555 in your docker run command).