Many people assume that I am using an IDE, so let me say it right now: I am not using an IDE.
I took the following Java source code, compiled it to Echo.class , and then created Echo.war , writing jar -cvf Echo.war Echo.class to Windows CMD and uploaded the file to the $TOMCAT_HOME/webapps :
@ServerEndpoint("/echo") public class Echo { @OnMessage public String echo(String incomingMessage) { return "I recieved ('" + incomingMessage + "'), so I am returning it."; } }
After starting Tomcat, I suddenly got the following folder structure:
<webapps> ... <Echo.war> <Echo> <Echo.class> <META-INF> <MANIFEST.MF> </META-INF> </Echo> </webapps>
When I try to open a connection to my endpoint via JavaScript using new WebSocket("ws://example.com:8080/Echo/echo") , I get a 404 response instead of 101 handshakes.
If this is any help, here is an image of what the manager shows: 
(Tomcat 8 update):
I updated Tomcat 8 after
this tutorial and now
catalina.out no longer empty, and the manager now shows this:

Here is the content of catalina.out , which is too large to be included in this post: http://pastebin.com/cwLviH5b
Echo.war is mentioned on lines 650 , 651 , 690 and 691 .
I studied a little and saw that if you create a class with Java 8, but Tomcat will work in Java 7, you will get UnsupportedClassVersionError . I did not get this error, but I thought that I could also upgrade Java 8 on my server. I did this and translated WAR, but nothing has changed.
I also changed the annotation from @ServerEndpoint("/echo") to @ServerEndpoint("/dest") in case of a name conflict, but that didn't help either.
Here is a quote from a book that I am reading :
Deploying an EchoServer WebSocket endpoint is especially easy. You need to compile the source file, include the class file in the WAR file, and deploy the WAR file. The web container will detect that there is a WebSocket endpoint included in the WAR file, and configure as necessary to deploy it. After you complete these steps, you are ready to make your first call to the WebSocket endpoint.
I realized that I needed to create a WAR file with one class file inside, but maybe it is not, because it says “WAR file” and not “WAR WAR”.
And according to this Wikipedia article , the WAR file should contain the web.xml file (one might wonder why he didn’t mention this). It's true? Does it really not work? If so, what should web.xml contain? Of course, this is not just an empty file called "web.xml".