Monday, July 2, 2012

Hibernate EHCache: ClassCastException in Cluster

I have 2 Hibernate/EHCache nodes in a cluster (managed by JGroups), and after I've done some transactions, I encounter the following error:

java.lang.ClassCastException: java.util.HashMap cannot be cast to org.hibernate.cache.entry.CacheEntry

The reason for this is that one node had "hibernate.cache.use_structured_entries" set to "true" while the other node didn't have this setting configured (presumably set to "false" by default).

After ensuring that both nodes had "hibernate.cache.use_structured_entries" set to "true", this error no longer occurred.

No comments:

Post a Comment