Websocket connection failed issue


I have a spring boot web application and I want to make real-time communication message features between anonymous users. I wrote the websocket configuration class and I am using enableStompBrokerRelay to connect with the server URL (I have created an ActiveMQ broker on the aws account and I tried with all given ports, and URLs and also provide the correct user name and passwords), I have searched on google for the solution but still I am not able to solve the issue

  • Alway getting this error Failed to connect to ssl://b-a53dd46c-4c2c-4b81-bfa3-6718c13b4bfe-1.mq.ap-south-1.amazonaws.com:61617. Attempting reconnect in 5000ms.

    If I remove 'ssl://' then getting........... CONNECTED: [id: 0xef127e7a, L:/ - R:b-a53dd46c-4c2c-4b81-bfa3-6718c13b4bfe-1.mq.ap-south-1.amazonaws.com/]

    CLOSED: [id: 0xef127e7a, L:/ ! R:b-a53dd46c-4c2c-4b81-bfa3-6718c13b4bfe-1.mq.ap-south-1.amazonaws.com/]

    Failed to connect to b-a53dd46c-4c2c-4b81-bfa3-6718c13b4bfe-1.mq.ap-south-1.amazonaws.com/ Attempting reconnect in 5000ms.

1 Answer
Accepted Answer

SSL Connection: When you include ssl:// in the server URL, you receive a connection failure. This suggests that your WebSocket connection is using SSL/TLS encryption. Make sure that the ActiveMQ broker on AWS is configured to support SSL/TLS connections and that the necessary certificates are set up correctly. Additionally, ensure that your Spring Boot application is configured with the appropriate truststore and keystore files for SSL/TLS communication.

Port and Protocol: The default port for the ActiveMQ broker is 61616 for non-SSL connections and 61617 for SSL connections. Double-check that you are using the correct port for your setup. If you are using SSL, verify that your ActiveMQ broker is configured to listen on port 61617 for SSL connections.

Network Access: Confirm that the necessary network access is configured to allow connections between your Spring Boot application and the ActiveMQ broker on AWS. Ensure that any firewalls or security groups are properly configured to allow traffic on the relevant ports.

Credentials: Double-check that the username and password you are providing in the WebSocket configuration are correct and have the necessary permissions to establish a connection to the ActiveMQ broker.

ActiveMQ Configuration: Verify that the ActiveMQ broker on AWS is properly configured to accept WebSocket connections and that it is running and accessible. Check the ActiveMQ logs for any errors or warnings that could provide additional information about the connection issues.

AWS Configuration: Ensure that you have set up the necessary AWS credentials and permissions for your Spring Boot application to connect to the ActiveMQ broker. Check that the IAM user or role associated with your application has the required permissions to access the broker.

profile picture
answered 9 months ago
  • I have created a new instance for ActiveMQ and not using SSL and I have also tried with all ports like 61616, 61617,61614, 61619, 5671,8883, and still issue not resolved

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions