Helle all.
Sorry for my bad english : i'm french 
Briefly : when two users use my application, only the last one is saved in ServletContext.
NB: I use ServletContextAware due to the null pointer exception return by this.getThreadLocalRequest().getSession(). After a long search on web someone tells to use ServletContextAware. I also try to set the session using this method. The result is exactly the same !
I explain my architecture : - I use hibernate + spring for my core library.
- I use GWT + spring for my web app.
Users enters the apps by a login form. This form call a rpc service which checks user in database. If user is valid => user saved in session.
Here is my rpc implementation :
Code:
public class SessionServiceImpl extends RemoteServiceServlet
implements SessionService, ServletContextAware {
private ServletContext servletContext;
@Override
public UserProperties checkLogin(UserProperties userToCheck){
UserProperties user = serv.isValidUser(userToCheck);
if (user != null) {
servletContext.setAttribute("USER", user);
}
return user;
}
@Override
public UserProperties isSessionAlive() {
UserProperties bean = (UserProperties) servletContext.getAttribute("USER");
if ((bean != null) && (bean.getLogin().length() != 0)) {
return bean;
}
return null;
}
}
I test with two diffrents browser Firefox (FF) and Chrome (CH).
- FF log with user1
- FF check session -> user1 is logged
- CH log with user2
- CH check session -> user2 is logged
- FF check session : user2 is logged
Can my problem come from web.xml?
Many thanks for reading !
Pierre