- Do you have the relevant classes available in your EAR ?
- Can you verify that the following should work: (1) put the jboss-cache.jar in jboss-xxx/server/xxx/lib and the XML file for the cache (e.g. tree-service.xml) in server/xxx/deploy. Then deploy your EAR and run your app again. The error should disappear.
- If you want everything in your EAR, you may have to create correct dependencies, e.g. between the SAR and the JAR which contains the offending classes.
I have discovered this problem recently. If you have a "scoped" application (jar, ear, or war), that implies different context class loaders. In this case, you will need to use the jboss utility class wrapper org.jboss.invocation.MarshalledValue to wrap your serializable object first before putting it into the cache.
Here is a snippet:
MyPOJO pojo = new MyPOJO();
MarshalledValue mv = new MarshalledValue(pojo);
Then to retrieve:
MasahlledValue mv = (MarshalledValue)cache.get("/ben");
MyPOJO pojo = (MyPOJO)mv.get();
Let me know if this doesn't work for you.
This should work for now. However, I'm going to add the mechanism used by MarshalledValue to JGroups itself, so this isn't needed. This will probably be in JBoss 3.2.6, I'm going to upgrade JGroups used by JBoss soon.