skip to Main Content

I was implementing Web Socket using JavaScript on the client and Java/Tomcat on the server. It works very fine on localhost but when I deploy on my remote host it fails. Checking the console, I get 500 error on the Web socket request. Hence i check the server error log to view the error and find –

java.lang.UnsupportedOperationException: HTTP upgrade is not supported by this protocol
    at org.apache.coyote.AbstractProcessor.doHttpUpgrade(AbstractProcessor.java:712) ~[tomcat-coyote.jar:8.5.20]
    at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:478) ~[tomcat-coyote.jar:8.5.20]
    at org.apache.coyote.Request.action(Request.java:433) ~[tomcat-coyote.jar:8.5.20]
    at org.apache.catalina.connector.Request.upgrade(Request.java:2022) ~[catalina.jar:8.5.20]
    at org.apache.catalina.connector.RequestFacade.upgrade(RequestFacade.java:1115) ~[catalina.jar:8.5.20]
    at org.apache.tomcat.websocket.server.UpgradeUtil.doUpgrade(UpgradeUtil.java:234) ~[tomcat-websocket-8.5.20.jar:8.5.20]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:77) ~[tomcat-websocket-8.5.20.jar:8.5.20]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:8.5.20]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.20]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.20]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:8.5.20]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [catalina.jar:8.5.20]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.20]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [catalina.jar:8.5.20]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.20]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [catalina.jar:8.5.20]
    at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:486) [tomcat-coyote.jar:8.5.20]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.20]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:8.5.20]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457) [tomcat-coyote.jar:8.5.20]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.20]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_11]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_11]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.20]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_11]

I did some research and stumbled on someone who had a similar problem and asked in this question WebSockets through Apache and Tomcat: HTTP upgrade is not supported by the AJP protocol but am running a private tomcat instance on a shared hosting server so the solutions provided in that answer cannot be achieved by me hence i contact my host and they respond with

‘While investigating your query, we could see that making changes in the tomcat and HTTP settings as per the steps mentioned in your email will affect the AJP connection configuration of another shared tomcat instance and the applications hosted by the shared tomcat instance will not work. For re-compiling, the connector settings also need a server-wide update and this cannot be done in a shared server environment. We request you to try our VPS plans by visiting the below link.’

I think purchasing a vps plan should be a last resort. Is there anyone here with a more conducive solution to the problem.

2

Answers


  1. You need VPS in this case. The last I’ve purchased was hetzner, they provide new plans with less powerful CPU or something like this, so I get 4gb RAM server for 5.88 USD / month, 1gb for 2.99

    Login or Signup to reply.
  2. One option is to work with Spring boot and embedded tomcat.
    So you are able to configure your own embedded instance of Tomcat.

    Here is a oint to start with:
    Spring with embedded Webserver

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search