1 Reply Latest reply on Apr 25, 2009 10:27 PM by Mahmoud Parsian

    ClassCastException with detached entities and memcached

    Jeremy Green Newbie

      Hello everyone, I'm trying to speed up object retrieval by using memcached and things work fine at first. When I redeploy my app and try to retrieve and object from memcached I get a class cast exception. If I kill memcache and restart it things go back to working OK, but I've lost all the cached entities. Does anyone know why this would happen?

      I have discovered that this problem does not occur if a client gets the entity from the server and stores it in memcached, it only happens when my objects home bean (stateless) is interfacing directly with memcached. To make it even stranger if I retrieve my object from memcached with a generic Object cast (instead of casting it to my class) and log o.getClass().getName() that matches what the class of the object should be. But then if I try to cast it as that Class, then I get a ClassCastException. Strange.

      Thanks,
      Jeremy