1002 error on tomcat + webSocket

Conclusion

If a 1002 error occurs on WebSocket, it is highly possible that an error has occurred on the server side.

Background

Not limited to JavaScript, WebSocket programming may return a 1002 error code from the server.


ws.onclose = function(event) {
    if (event.wasClean) {
        alert("[close] Connection closed cleanly");
    } else {
    console.log("[close] Connection died " + event.code + "," + event.reason);
    }
};

[close] Connection died 1002,An unrecoverable IOException occurred so the connection was closed

However, when I look at the console on the server side (Tomcat 8.5), nothing is displayed. I was addicted to it here.

(Why ... and half a day passed)

A closer look at the server-side code reveals that there are cases of NullPointerException, and after fixing it, it works as intended. If you get a NullPointerException, I would like it to be output on the server console as well.

Recommended Posts

1002 error on tomcat + webSocket
JSP on tomcat
Tomcat v8 on CentOS7
Error resolution on Heroku
Install tomcat on Sakura's VPS
Install tomcat + eclipse on mac
Error when npm install on Windows 7
moved! JSF + CDI (Preferences) on Tomcat
Error when deploying EC2 on CircleCI
DB error on deploying with Heroku
Change JDK and Tomcat versions on CentOS
Deploy Java Servlet app locally on Tomcat
Relative path when running tomcat on eclipse
Build Apache + Tomcat + Pebble locally on Mac