We use JBoss Cache Version 1.4.1 GA. When trying to serialize an object stored in PojoCache, we receive a java.io.NotSerializableException.
Here a concrete example:
- we put a Vector, containing String variables into PojoCache on server: (pojoCache.putObject(pojoKey, aVector)
- When reading the object from cache (pojoCache.getObject(pojoKey)), we get an object of type AOPClassProxy0, which has amongst others an attribute of type CachedListInterceptor, that is not serializable.
- when trying to serialize, we receive: java.io.NotSerializableException:org.jboss.cache.aop.collection.CachedListInterceptor
How can we solve this problem? We only need the vector data to put them to client cache after transferring from server to client.
You can't unless you do a proper removeOjbect first. E.g., before sending it out thru the wire, you will need:
v = cache.removeObject(fqn);
Otherwise, it is a proxy that not serializable because it contains local data only.
Or another option is cloning it first before sending it, and then do a putObject if you decide to put it back to the cache.