Christian Wansart wrote:The interesting thing was, that it wasn't send to ws:// but to http:// instead. When I try to access http://myServer:8080/wsock/chat I get a 404 error page by Tomcat. So I guess that Java or Tomcat is redirecting those WebSocket messages on my local machine. (But that's only an assumption.)
Karthik Shiraly wrote:A successful WS handshake shouldn't contain a "content-type" response header. So I suppose the response here is the standard 404 resource not found tomcat page, which OP should verify from dev tools response tab.
Karthik Shiraly wrote:1) The URLs changed as this discussion progressed, making it a bit confusing.
Since this is a 404 error, first thing to verify is that all the actual URLs in code and deployment are correct, even if they were typed differently in these posts.
From the first post, it looks like WS URL is "ws://myServer:8080/wsock/chat". Assuming "myServer:8080" is actually "http://192.168.2.103:8888", it means you have the WS servlet deployed in a second web app called wsock.war.
Is this the case?
Karthik Shiraly wrote:2) Deploying to Tomcat from Eclipse is usually rather misleading because Eclipse makes a temp copy of the selected server's files and deploys in the copy.
What you want to do is make a WAR and deploy that on the standalone Tomcat. I suppose that's exactly what you're doing here, but just something to remember.
Karthik Shiraly wrote:3) Check that "tomcat7-websocket.jar" and "websocket-api.jar" are in Tomcat server's lib directory.
That's usually "/usr/share/tomcat7/lib" in GNU/Linux distros, or TOMCAT_DIR/lib in Windows.
Karthik Shiraly wrote: 4) Ensure that your WAR's WEB-INF/lib does not have any of the standard Tomcat JARs like "servlet-api.jar", "tomcat*.jars", or "websocket-api.jar".
Karthik Shiraly wrote:5) Finally, check the logs. Look for successful deployment of the WAR containing the WS servlet.
Karthik Shiraly wrote:- tomcat7 installed from repos on 192.168.2.103 had missing WS jars.
You've now uninstalled the repo version (to ensure there's no clashes with new version), and replaced it with Tomcat7 downloaded directly from Apache.
I assume you've verified that websocket JARs are actually present in this new version?
Karthik Shiraly wrote:- In the new version, wsock.war deployed correctly with no error in logs and listening on both 8080 and 8888 (or are these 2 different Tomcat instances).
Karthik Shiraly wrote:If the classes were built with Java 8 compiler but deployed on machines with older Java 7 JRE, you should see Unsupported class version error in tomcat logs.