Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1014315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:14:06+00:00 2026-05-16T10:14:06+00:00

I have a GWT+GAE web app with several service and modules. I am using

  • 0

I have a GWT+GAE web app with several service and modules. I am using the module functionlity of mvp4g. All of my services extends:

public abstract class BaseServiceImpl extends RemoteServiceServlet {
 protected final static Map USERS = new HashMap();

I use USERS to store my current active user sessions. Once I user authenticates himself I store his session id as a key of the map.

protected String getSessionId() {
    return getThreadLocalRequest().getSession().getId();
}

public String authenticate(String username, String password) {
    ...
    ..
    .
   String id = getSessionId();
   synchronized( this ) {    
       users.put(id, user);
   } 
   ...
   ..
   .

For every request, I check if the user session is still valid.

protected boolean validUserSession() {  
    if(getThreadLocalRequest() == null) {
     logger.log(Level.SEVERE, "Thread is null");
     return false;
 } else if(getThreadLocalRequest().getSession() == null) {
     logger.log(Level.SEVERE, "Session is null");
     return false;
 }
 String id = getSessionId();
 UserJDO user = (UserJDO) users.get(id);
 if(user==null) {   
     logger.log(Level.SEVERE, "User is null");
     return false;
 }
 return true;
}

I have sessions enabled. Next I post the last lines of appengine-web.xml

...
..
.
<sessions-enabled>true</sessions-enabled>
</appengine-web-app>

Everything works fine in the Development server. However, when I deploy it to the google app engine cloud the users variable is reset for every request.

Can anyone explain me what it is happening? How should I proceed? Should I store the user sessions in the datastore?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:14:06+00:00Added an answer on May 16, 2026 at 10:14 am

    In GAE, each request may hit different server. Furthermore, your application might be undeployed and redeployed again before each request. You should not rely on static variables. Save your state in sessions or in database.

    Here is quote from http://code.google.com/appengine/docs/java/runtime.html

    App Engine uses multiple web servers to run your application, and automatically adjusts the number of servers it is using to handle requests reliably. A given request may be routed to any server, and it may not be the same server that handled a previous request from the same user.

    Once you enable sessions, they are automatically stored to datastore at the end of requests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have experience writing a Facebook application using GWT with GAE? I'm new
I have an app written with GWT and GAE where every supported city has
We have a small app with Restlet on the GAE server and GWT and
Have you tried using MVC or any other UI pattern for GWT client code.
I'm using GWT with GAE. When the user enters any of the following urls,
I have a Google Web Toolkit application that I am deploying to Google App
I'm using the Google App Engine in combination with the Google Web Toolkit to
I'm playing with a GWT/GAE project which will have three different pages, although it
I have a need to capture IP address of the client in my GWT/GAE
So, I have a GWT client, which interacts with a Python Google App Engine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.