Can I use UseRegionBasedMarshalling attribute in JBoss Cache in order to get around ClassCastExceptions happening when accessing data in the cache that has just been redeployed?
Yes, you can. Originally, cache Marshalling was designed as a workaround for those replicated caches that upon state transfer did not have access to the classloaders defining the objects in the cache. On each deployment, JBoss creates a new classloader per the top level deployment artifact, for example an EAR. You also have to bear in mind that a class in an application server is defined not only by the class name but also its classloader. So, assuming that the cache is not deployed as part of your deployment, you could deploy an application and put instances of classes belonging to this deployment inside the cache. If you did a redeployment and try to do a get operation of the data previously put, this would result on a ClassCastException. This is because even though the class names are the same, the class definitions are not. The current classloader is different to the one when the classes were originally put. By enabling marshalling, you can control the lifecycle of the data in the
Related Questions
- Can I use UseRegionBasedMarshalling attribute in JBoss Cache in order to get around ClassCastExceptions happening when accessing data in the cache that has just been redeployed?
- attribute in JBoss Cache in order to get around ClassCastExceptions happening when accessing data in the cache that has just been redeployed?
- Does JBoss Cache support cache passivation/overflow to a data store?