我遇到了一个非常奇怪的问题。当两个用户同时登录时,其中一个被检测为另一个。
locale = new Locale(getLocale(request).getLanguage(), getLocale(request).getCountry());
strRemoteUser = WebTools.getUserIdWithoutDomainName(request.getRemoteUser()).toUpperCase();
logger.info("[MYAPP] User " + strRemoteUser + " is logging in");
logger.info("[MYAPP] Creating session for : " + strRemoteUser);
HttpSession session = request.getSession(false);
if (session != null) {
session.invalidate();
session = request.getSession();
}
logger.info("[MYAPP] User in session is : " + strRemoteUser);
我得到的是以下内容。让我们假设两个用户(USR001 和 USR002)同时登录到应用程序。它们位于不同的位置。
日志:
2013-05-14 08:19:38,550 INFO [com.myapp.action.common.LoginAction] [MYAPP] User USR001 is logging in
2013-05-14 08:19:38,551 INFO [com.myapp.action.common.LoginAction] [MYAPP] Creating session for : USR001
2013-05-14 08:19:38,760 INFO [com.myapp.action.common.LoginAction] [MYAPP] User USR002 is logging in
2013-05-14 08:19:38,761 INFO [com.myapp.action.common.LoginAction] [MYAPP] Creating session for : USR002
2013-05-14 08:19:38,834 INFO [com.myapp.action.common.LoginAction] [MYAPP] User in session is : USR002
2013-05-14 08:19:39,104 INFO [com.myapp.action.common.LoginAction] [MYAPP] User in session is : USR002
2013-05-14 08:19:39,425 INFO [com.myapp.action.common.LoginAction] [MYAPP] Auto Added User USR002
2013-05-14 08:19:39,550 INFO [com.myapp.action.common.LoginAction] [MYAPP] Setting user in session: USR002 (673)
如您所见,USR002“赢得”并发会话创建,因为 USR001 现在被识别为 USR002。如果 USR001 注销然后重新登录,它可以正常工作。
有什么想法/建议吗?
非常感谢您的帮助。
眼镜:
- jBoss 4.2.3GA
- PostgreSQL 9.0.3
- Struts 1.3.5
- EJB3