Do see my reply to your Java-specific post in the GAE/J group:

  
http://groups.google.com/group/google-appengine-java/browse_thread/thread/59a1af5fb7a43373#


On Mar 1, 7:05 pm, "Ikai Lan (Google)" <[email protected]>
wrote:
> Is this something that happens locally, or in production? I haven't tried
> the code, but my suspicions are:
>
> 1. Something is happened with the serialization of the object when it's
> being saved. Could this value be set elsewhere?
> 2. The generics are breaking serialization. This seems strange to me, though
>
> Can you post UserDetails?
>
> If you aren't keen to solve this, another workaround would be to simply
> write your own serialization and deserialization code via JSON or protobuf.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blogger:http://googleappengine.blogspot.com
> Reddit:http://www.reddit.com/r/appengine
> Twitter:http://twitter.com/app_engine
>
> On Mon, Feb 28, 2011 at 10:01 PM, GWTNewbie <[email protected]> wrote:
> > Hello:
> > I am using memcache to keep track of logged users in an app that I am
> > building. However when I do a GET on the memcache I get an exception:
>
> > exception: java.lang.ClassCastException: java.util.ArrayList cannot be
> > cast to java.util.HashMap
>
> > From the logs it appears that the exception is caused by the
> > statement:
> >                HashMap<String, UserDetails> userMap = (HashMap<String,
> > UserDetails>) _cache
> >                                .get(user.getInstance());
> > in the method logOn.
>
> > Any ideas as to what the issue could be ?
> > ---------------------------------
> > Code snippet below:
>
> > import com.samuuhanet.main.shared.UserDetails;
>
> > public class LoggedUsers {
> >        private static LoggedUsers _cacheInstance;
> >        private static boolean _invalidationDone = false;
>
> >        private Cache _cache;
>
> >        public static final Logger _log = Logger.getLogger(LoggedUsers.class
> >                        .getName());
>
> >        private LoggedUsers() {
> >                try {
> >                        CacheFactory cacheFactory =
> > CacheManager.getInstance()
> >                                        .getCacheFactory();
>
> >                        _cache =
> > cacheFactory.createCache(Collections.emptyMap());
> >                } catch (CacheException e) {
> >                        // Log stuff
> >                        _log.log(Level.WARNING, "Error in creating the
> > Cache");
> >                }
>
> >        }
>
> >        public static synchronized LoggedUsers getInstance() {
> >                if (_cacheInstance == null) {
> >                        _cacheInstance = new LoggedUsers();
> >                }
> >                return _cacheInstance;
> >        }
>
> >        public void logOn(UserDetails user) {
>
> >                if (_cache == null)
> >                        return;
>
> >                HashMap<String, UserDetails> userMap = (HashMap<String,
> > UserDetails>) _cache
> >                                .get(user.getInstance());
> >                // Check if user already exists
> >                if (userMap == null) {
> >                        userMap = new HashMap<String, UserDetails>();
> >                }
>
> >                userMap.put(user.getUserName(), user);
> >                _cache.put(user.getInstanceID(), userMap);
> >        }
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to