Stuck configuring TreeCacheAOP - am I missing something?
gregorypierce Jul 18, 2005 4:47 PMNow that I've got the front end caching done using Treecache (piece of cake), I've been fighting with TreeCacheAop to get it to work right. I've followed all the exampled in the docs:
I've created a jboss-aop.xml ,
<aop> <prepare expr="field(* $instanceof{com.sojournermobile.util.testdata.Rectangle}->*)" /> </aop>
but that didn't work on its own. Even though I was using the special class loader and had the META-INF stuff in the classpath (confirmed by doing a getResource() on that file and it came up properly). I can't find a way to see why its not loading my jboss-aop.xml from scratch without precompiling my classes
So I changed the jboss-aop.xml to instrument everything in a particular package (which is where I store all these data objects now):
<aop> <prepare expr="field(* $instanceof{com.sojournermobile.util.testdata.*}->*)" /> </aop>
I've precompiled classes using aopc
<taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="module.classpath"/> <target name="aopc" depends="compile" description="Precompile aop class"> <aopc compilerclasspathref="module.classpath" verbose="true"> <classpath path="${build}"/> <src path="${build}"/> <include name="**/*.class"/> <aoppath path="/projects/utils/aop/META-INF/jboss-aop.xml"/> </aopc> </target>
I've set up precompilation using ant (which actually doesn't seem to be instrumenting my test class in the same manner it wasn't before:
[trying to transform] com.sojournermobile.util.testdata.Rectangle [debug] is advisable method: getX [debug] does getX match field(* $instanceof{com.sojournermobile.util.testdata.*}->*): false [debug] is advisable method: setX [debug] does setX match field(* $instanceof{com.sojournermobile.util.testdata.*}->*): false ... [debug] was com.sojournermobile.util.testdata.Rectangle converted: true
package com.sojournermobile.util.testdata; import org.apache.log4j.*; /* * @@org.jboss.cache.aop.AopMarker */ public class Rectangle { public static Logger logger = Logger.getLogger("Rectangle"); private int x; private int y; private int width; private int height; private long commitTime; public int getX() { return x; } public void setX(int x) { this.x = x; } ... }
No matter what I try to do, I have an issue putting this object into the cache:
java.lang.IllegalArgumentException: TreeCacheAop.putObject(): Object type is neither aspectized nor Serializable. Object class name is com.sojournermobile.util.Rectangle
at org.jboss.cache.aop.AopUtil.checkObjectType(AopUtil.java:90)
at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:146)
at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:376)
at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:255)
at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:226)
at com.sojournermobile.util.server.jndi.DirectoryServiceProviderImpl.main(DirectoryServiceProviderImpl.java:110)
I've gone through the docs a few times now over the past few days and I don't know what's up. Looking at the AOP results suggests that its not preparing the fields and this is my best bet as to what is going wrong, but after having gone through the JbossAOP stuff and the TreeCacheAOP docs several times it looks like I'm doing the right thing.
I've got to be missing something but I just don't see it.