WebSocket握手期间出错:意外的响应代码

San*_*l S 5 java websocket handshake

在我的客户端服务器中部署项目时,我收到此错误.

与'ws:// webserver:8080/Project/notificationendpoint'的WebSocket连接失败:WebSocket握手期间出错:意外响应代码:404

在我的系统中运行代码没有问题.我们都使用Ubuntu 14.04.(32位).我的chrome版本:47.0.2526.106.客户端版本:48.0.2564.109

这就是我在js中获取主机位置的方式:

var wsUri = "ws://" + document.location.host + "/Project/notificationendpoint";
var websocket = new WebSocket(wsUri);
Run Code Online (Sandbox Code Playgroud)

它连接到服务器端点:

@ServerEndpoint(value = "/notificationendpoint",
    encoders = {NotifyEncoder.class},
    decoders = {NotifyDecoder.class})
public class Notification {
......
}
Run Code Online (Sandbox Code Playgroud)