Pls help with a simple Mixin problem
guava Dec 1, 2006 8:13 PMHi,
I'm started to use the Introduction feature of JBossAOP and can not seem to get the Mixin working. Any help will be appreciated. I have one Pojo, one Aspect, one Mixin, and an interface the mixin implements. I'm running these in the same directory as the examples provided by JbossAOP. Following are the classes:
//------ MyPojo
public class MyPojo {
}
//------ MyInf
public interface MyInf {
String hello(String h);
}
//-----MyMixin
public class MyMixin implements MyInf {
public String hello(String h) {
return "Hello " + h;
}
}
//---- MyAspect
import org.jboss.aop.Aspect;
import org.jboss.aop.Mixin;
import org.jboss.aop.Introduction;
@Aspect
public class MyAspect
{
@Mixin (target=MyPojo.class, interfaces={MyInf.class})
public static MyMixin createMyMixin() {
return new MyMixin();
}
}
I'm getting a javassist.NotFoundException: LMyMixin when I run aop compiler.
Following are the build file and the stack trace:
//--------- stack trace
[aopc] [debug] Passed in instrumentor: null
[aopc] [debug] Defaulting instrumentor to: org.jboss.aop.instrument.Classic
Instrumentor
[aopc] [debug] jboss.aop.class.path: C:\tools\jboss-aop_1.5.2.GA\docs\aspec
t-framework\examples\temp1
[aopc] [debug] Looking for aspects in: MyAspect
[aopc] [debug] Found @Aspect in: MyAspect
[aopc] [debug] Looking for aspects in: MyInf
[aopc] [debug] Looking for aspects in: MyMixin
[aopc] [debug] Looking for aspects in: MyPojo
[aopc] [debug] jboss.aop.search.classpath: 'null' true
[aopc] [debug] jboss.aop.path: null
[aopc] [trying to transform] MyMixin
[aopc] [debug] There are no caller pointcuts!
[aopc] [debug] javassist.CtMethod@ca717109[public hello (Ljava/lang/String;
)Ljava/lang/String;] matches no pointcuts
[aopc] [debug] javassist.CtConstructor@fec107[public MyMixin ()V] matches n
o pointcuts
[aopc] [debug] was MyMixin converted: false
[aopc] [no comp needed] C:\tools\jboss-aop_1.5.2.GA\docs\aspect-framework\e
xamples\temp1\MyMixin.class
[aopc] [cannot compile] isInterface: MyInf
[aopc] [no comp needed] C:\tools\jboss-aop_1.5.2.GA\docs\aspect-framework\e
xamples\temp1\MyInf.class
[aopc] [trying to transform] MyAspect
[aopc] [debug] There are no caller pointcuts!
[aopc] [debug] javassist.CtMethod@8676605a[public static createMyMixin ()LM
yMixin;] matches no pointcuts
[aopc] [debug] javassist.CtConstructor@64f6cd[public MyAspect ()V] matches
no pointcuts
[aopc] [debug] was MyAspect converted: false
[aopc] [no comp needed] C:\tools\jboss-aop_1.5.2.GA\docs\aspect-framework\e
xamples\temp1\MyAspect.class
[aopc] [trying to transform] MyPojo
[aopc] [debug] There are no caller pointcuts!
[aopc] [debug] javassist.CtConstructor@5e5a50[public MyPojo ()V] matches no
pointcuts
[aopc] javassist.NotFoundException: LMyMixin
[aopc] at javassist.ClassPool.get(ClassPool.java:416)
[aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.j
ava:250)
[aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions
(Instrumentor.java:336)
[aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.
java:672)
[aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
[aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
[aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:3
45)
[aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
[aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
[aopc] java.lang.RuntimeException: failed to transform: MyPojo
[aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.
java:732)
[aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
[aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
[aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:3
45)
[aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
[aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
[aopc] Caused by: javassist.NotFoundException: LMyMixin
[aopc] at javassist.ClassPool.get(ClassPool.java:416)
[aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.j
ava:250)
[aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions
(Instrumentor.java:336)
[aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.
java:672)
[aopc] ... 5 more
[aopc] Exception in thread "main" java.lang.RuntimeException: failed to tra
nsform: MyPojo
[aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.
java:732)
[aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
[aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
[aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:3
45)
[aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
[aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
[aopc] Caused by: javassist.NotFoundException: LMyMixin
[aopc] at javassist.ClassPool.get(ClassPool.java:416)
[aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.j
ava:250)
[aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions
(Instrumentor.java:336)
[aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.
java:672)
[aopc] ... 5 more
BUILD FAILED
C:\tools\jboss-aop_1.5.2.GA\docs\aspect-framework\examples\temp1\build.xml:33: J
ava returned: 1
//----- build.xml (identical to JBossAOP example jboss-aop_1.5.2.GA\docs\aspect-framework\examples\annotated-introduction)
<?xml version="1.0" encoding="UTF-8"?>