[wildfly-dev] ClassCastException when get Object from Replicated Cache after redeploy

Domenico Briganti dometec at gmail.com
Sun Nov 10 05:32:58 EST 2013


Hi all,
I'm using an Infinispan Replicated cache with WildFly Beta 1. It happen
that when I get a value from cache after a redeploy a get a
ClassCastException:
a.b.C cannot be cast to a.b.C.

Certainly this is for modular class loader of WildFly.

Now I resolved the issue cloning the object on ClassCastException:

try {
AuthUserEntry authUserEntry = getCache().get(key);
return authUserEntry;
} catch (ClassCastException e) {
return DeepCopy.copy(getCache().get(key));
}

Not so elegant, but it works.
There is a better solution?

Thank you,
Domenico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20131110/af8bb919/attachment.html 


More information about the wildfly-dev mailing list