amazon-web-servicesnetbeanswebsockettomcat7handshake

websocket - Response code was not 101: 200 - Handshake error


I have my java desktop application running which act as a client in websocket communication.

Server code (webservice) is deployed on tomcat on AWS.

When i try to run code locally, both desktop application and tomcat server, it works fine.

The moment i point my desktop application to production url, deployed on tomcat on AWS, i get below exception. Even i tried creating .exefile using excelsior jet, but still same issue while running .exe file.

Exception

ex = (javax.websocket.DeploymentException) javax.websocket.DeploymentException: Handshake error.

Response code was not 101: 200

I am running on Netbeans, but it fails while calling server endpoint.

These are my libraries used for desktop application.

enter image description here


Solution

  • I found a solution,

    I was missing a port after hostname,
    

    URL i was using was,

    ws://hostname/endpointname

    instead of this one

    ws://hostname:port/endpointname

    By default if Tomcat is running on port:80, no need to provide the port in url, but i changed my tomcat to 8080 port.