WebSocket建立连接时候发生404错误,不知道是路径还是其他什么错误

初学WebSocket,做了一个Demo,出现404错误。
WebSocket connection to 'ws://localhost:8088/chat/begin?uname=xiaoming' failed: Error during WebSocket handshake: Unexpected response code: 404

JS代码:

 var chat={};
        chat.socket=null;
        var uname="<%=request.getSession().getAttribute("uname")%>"

        function conn(){
            connect("ws://localhost:8088/chat/begin?uname="+uname);
        }

        function connect(host){
            if("WebSocket" in window){
                chat.socket=new WebSocket(host);
            }else if("MoWebSocket" in window){
                chat.socket=new MoWebSocket(host);
            }else{
                console.log("当前浏览器不支持WebSocket");
                return;
            }
        }

后台终端代码:

 @ServerEndpoint("/begin")
public class ChatServer {

    @OnOpen
    public void start(Session session){
        System.out.println(session.getQueryString());
    }
}

使用的是eclipse开发,Web服务器使用Tomcat7,jdk版本是1.8。

http://liyunpeng.iteye.com/blog/1979718

你好,我也是这个毛病, 你解决了么?

路径不对 @ServerEndpoint("/begin") 看这里是不是对的