ClassNotFoundException when using lazy deserialization in JBoss Cache
Environment
- Red Hat JBoss Enterprise Application Platform (JBoss EAP)
- 5.0.x
- 5.1.x
Issue
-
Seeing a ClassNotFoundException in the logs after implementing lazy initialization.
ERROR [org.jboss.cache.interceptors.TxInterceptor] (Incoming-15,myCluster,10.1.2.3:7600) prepare failed! org.jboss.cache.CacheException: Unable to unmarshall value ... [JGroups classes] Caused by: java.lang.ClassNotFoundException: com.example.MyClass -
ClassNotFoundException while calling cache.put when using lazy deserialization and scoped classloading
Resolution
This is a bug JBPAPP-9574, which is fixed in JBoss EAP 5.2.
The cache.put call tries to deserialize the current value of the cache node to return it.
However, it's also doing this on the remote cluster members during replication, which don't have the correct classloader set.
Since the values from the remote members are ignored, the value shouldn't be deserialized there.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
