[jboss-dev-forums] [Design of JBossCache] - Re: Default classloader for deserialization

bstansberry@jboss.com do-not-reply at jboss.com
Tue Nov 28 14:54:31 EST 2006


This thread is about independent usage of JBC, not as part of ejb3/hibernate/httpsession repl where we have an integration layer that can take advantage of the existing region-based marshalling API.

Here's the problem:

EAR packages class Foo, and also deploys a JBC instance via a -service.xml or -beans.xml.  Application places instances of Foo in the cache, which then get replicated.

When the replication message is received, Foo needs to be deserialized.  This is done by the thread coming up from JGroups.  This deserialization is done using the classloader for server/all/lib, which is where the JBC and JGroups jars are located.  Thus class Foo is not visible to the classloader. Replication fails with a CNFE. Same problem occurs with state transfer when a 2nd node joins a cluster where there's existing data.

Solutions to this problem are:

1) Place Foo.class in server/all/lib.
2) Turn on region-based marshalling and register a classloader with the cache, effectively saying for example, for any replication traffic related to Fqn's below "/a", use this classloader to deserialize the message. If this feature is turned on, all replication messages consist of two components -- first a serialized Fqn that identifies which region the message pertains to (used by the recipient to look up the classloader) and then the regular serialized MethodCall.

anonymous wrote : To me this is another wrapper that integrates well with this usage. Its an mbean service/mc bean that performs the same deployment level integration as the other jboss cache based aspects.

This is one possible solution, and perhaps the best. The downside to it is it adds the overhead of including the region-identifier Fqn in each replication message -- which isn't really needed if there is only one correct classloader for the whole cache.

So, the purpose of this thread is to explore that and possibly other solutions.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989459#3989459

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989459



More information about the jboss-dev-forums mailing list