1

My application used sockjs & Application is running on Tomcat 8 and APACHE HTTP as front end web server. I have observed that xhr_send request getting stalled and so hangs the application. On Chrome developer console, received following error

enter image description here

when xhr_send request stalled I never received CONNECTED response.

I used following code to setup websocket

socket = new SockJS(applicationMainService.getUrl()+'/ws');
stompClient = Stomp.over(socket);

Also received following error in Tomcat logs

[org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler@1e7904b0]: org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=https://pods.jlrint.com:443/PODSWeb/ws/112/fvi5za3c/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol

06:35:04.129 [ajp-nio-8009-exec-11] DEBUG o.s.web.servlet.DispatcherServlet - Could not complete request org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=https://xyzabc.com:443/MyRoot/ws/112/fvi5za3c/websocket; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: WebSocket handshake failure; nested exception is java.lang.UnsupportedOperationException: HTTP upgrade is not supported by the AJP protocol at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:91) ~[spring-websocket-4.0.2.RELEASE.jar:4.0.2.RELEASE]

Please help.

Anupam Pawar
  • 231
  • 3
  • 16
  • `HTTP upgrade is not supported by the AJP protocol` AJP connector doesn't support websockets. Use HttpConnector and mod_proxy_wstunnel – user1516873 Jan 11 '18 at 12:18
  • Yeah I read it and aware of this, but looking out detailed steps or guide to do the same ? We are using mod_jk for load balancing and SSL certificate for HTTPS. – Anupam Pawar Jan 11 '18 at 17:11
  • Do you have cluster or just one tomcat and one apache as proxy? – user1516873 Jan 12 '18 at 07:45
  • Yeah in Prod environment we do have Cluster ( 2 nodes with Load Balancer) – Anupam Pawar Jan 12 '18 at 08:29
  • https://stackoverflow.com/a/42578769/1516873 example for cluster and sticky sessions – user1516873 Jan 12 '18 at 09:46
  • @user1516873 I have made following changes in httpd.conf but still observed that my request is getting stalled. I'm doing it in QA Environment ( which does not have Load balancer) ServerName my.example.com:443 SSLEngine On -- SSL Cerification configuration changehere ProxyPass /ws http://my.example.com:8081/MyWeb/ws ProxyPassReverse /ws http://my.example.com:8081/MyWeb/ws RewriteEngine on RewriteCond %{HTTP:UPGRADE} WebSocket [NC] RewriteCond %{HTTP:CONNECTION} Upgrade [NC] RewriteRule .* ws://my.example.com:8081/MyWeb$1 [P,L] – Anupam Pawar Jan 12 '18 at 18:54
  • sorry, maybe something lost, asterisk i think. It is better to ask on Serverfault as different question with right formatting. – user1516873 Jan 15 '18 at 07:21
  • I'm still not able to solve this. Raised question in serverfault. Thanks – Anupam Pawar Jan 15 '18 at 08:53

0 Answers0