This content has been marked as final.
Show 4 replies
-
1. Re: TreeCacheAop and default constructors
ben.wang Mar 24, 2004 9:32 PM (in response to peterox)The error you are seeing should have nothing to do with TreeCacheAop.
TreeCacheAop does not require a POJO to have a default constructor. It does not replicate the whole object (therefore no need for Serializable either). Instead, it breaks down the object by mapping the members into primitive types eventually.
There are couple of aop test cases under testsuite and "examples" directory of the standalone package. Maybe you want to check out the usage there.
Thanks,
-Ben -
2. Re: TreeCacheAop and default constructors
paulvallender Nov 15, 2004 4:51 AM (in response to peterox)Hi,
TreeCacheAop does not require a POJO to have a default constructor.
I am sure this is true, However, I am also having problems with Class instantiation exceptions. The problem only occurs when a second cache attempts a getObject for an object created in the first cache.
If the class has no contructors then everything is fine. If the class has one or more constructors (but no default), then the class loader creates an instantiation exception. If a default constructor is added, then everthing works.therefore no need for Serializable either
In the situation where one cache is running and objects are added. A second cache starts and the initial state is transferred to the second cache. If the objects are not Serializable then a class not serialized exception occurs (at least for me it does). It seems that serialization is required to tranfer the initial state. Is this true or is it something that I am doing wrong (I have had a look through the doc, sorry if I have missed this).
Many thanks. -
3. Re: TreeCacheAop and default constructors
belaban Nov 15, 2004 5:36 AM (in response to peterox)"paulvallender" wrote:
Hi,therefore no need for Serializable either
In the situation where one cache is running and objects are added. A second cache starts and the initial state is transferred to the second cache. If the objects are not Serializable then a class not serialized exception occurs (at least for me it does). It seems that serialization is required to tranfer the initial state. Is this true or is it something that I am doing wrong (I have had a look through the doc, sorry if I have missed this).
Many thanks.
No, Serializable is *not* required, but you need to declare all your POJO objects. Because we map POJOs down to their primitive types (boolean, int, String etc), and add those to the (superclass) TreeCache, we will by definition only transfer serializable types on state transfer.
If you don't declare your POJOs in jboss-aop.xml, then we fall back to Serializable/Externalizable, and if a non-declared POJO doesn't implement any of those 2 interfaces, serialization throws an exception.
State transfer is implemented in TreeCache, not TreeCacheAop.
Bela -
4. Re: TreeCacheAop and default constructors
paulvallender Nov 15, 2004 10:31 AM (in response to peterox)Bela,
Thanks for the quick reply. I thought I had declared all POJOs in that test, but it seems this wasn't the case (I can't reproduce the Serialisation error today).
Thanks,
Paul.