使用tomcat8写了个webSocket聊天室,出现如下异常

图片说明
如图,在本地运行无异常,上传至阿里云服务器后开始时无异常,等待一段时间(推测是session timeout后)出现如图异常

package com.project.webSocket;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.project.service.Manager;
import com.project.service.impl.ManagerImpl;
import com.project.utils.GetHttpSessionConfigurator;

//@ServerEndpoint注解表示将 WebSocket服务端运行在 以ws://开头的访问端点
@ServerEndpoint(value = "/SocketServer",configurator = GetHttpSessionConfigurator.class)
public class SocketServer{
private static final long serialVersionUID = 1L;
//将httpSession,socketSession放在一个map里,代表一个用户
private static final HashMap onlineUsers = new HashMap();
private static int onlineCount = 0;
//定义客服人员的名字(对应cookie--user_id)
private static String customerService1 = "A002";
private static String customerService2 = "A003";
private HttpSession httpSession;
/**
* WebSocket Session
*/
private Session session;

//使用 ServerEndpoint 注释的类必须有一个公共的无参数构造函数
public SocketServer() {
}

/**
 * 打开连接
 * 
 * @param session
 */
@OnOpen
public void onOpen(Session session,EndpointConfig config) {
    this.session = session;
    this.httpSession = (HttpSession)config.getUserProperties().get(HttpSession.class.getName());
    httpSession.setMaxInactiveInterval(60000);
    if(httpSession.getAttribute("user") != null){
        onlineUsers.put(httpSession, this);
    }
    addOnlineCount();
    System.out.println("++++当前人数" + onlineUsers.size());
    System.out.println(httpSession.getAttribute("user"));
}

/**
 * 关闭连接
 */
@OnClose
public void onClose() {
    onlineUsers.remove(httpSession,this);//从map中删除
    subOnlineCount();
    System.out.println("----当前人数" + onlineUsers.size());
}

     /**
 * 错误信息响应
 * 
 * @param throwable
 */
@OnError
public void onError(Throwable throwable) {
    System.out.println("连接异常");
    System.out.println(throwable.getMessage());
}


    请问是什么问题造成的?

客户端也需要设置session过期时间的