Details
-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
6.0.0.Final
-
None
Description
Infinispan throws NotSerializableException when trying to put inner class to write-behind cache.
Here is the example:
class which I want to store in cache (actually, it's inside the other class)
final class PojoCoder implements Serializable { private static final long serialVersionUID = -6238699065180988597L; private String name_; private String favouriteLanguage_; PojoCoder(String name, String favouriteLanguage) { name_ = name; favouriteLanguage_ = favouriteLanguage; } @Override public String toString() { return name_ + " loves " + favouriteLanguage_; } public String getFavouriteLanguage() { return favouriteLanguage_; } public String getName() { return name_; } }
cache config
final EmbeddedCacheManager cacheManager = new DefaultCacheManager(); cacheManager.defineConfiguration(CACHE_NAME, new ConfigurationBuilder() .eviction() .maxEntries(2) .persistence() .passivation(false) .addSingleFileStore() .location(tmpStoragePath) .maxEntries(6) .build());
code that fails
final Cache<String, PojoCoder> testCache = cacheManager.getCache(CACHE_NAME); testCache.put("alex", new PojoCoder("django-lover alex", "Python")); //NotSerializableException on this line
Actually, stack trace tells something about problem with this reference.
Unfortunatelly, I don't have time to investigate deeper this issue - inner class was created just for test, normally I would store typical outer classes.