[jboss-user] [JBoss AOP] - Dynamic AOP

sylobsa do-not-reply at jboss.com
Mon Sep 24 12:38:25 EDT 2007


Hi,

I use JBoss AS 4.2.0, JDK 5.0, JBoss AOP 1.5.5.

I have a J2EE application and I'd like to use dynamic AOP on it. I want to aspectize only a few classes, so I annotated those classes with :
@Prepare ("all(this)")

Now I want to compile them.

I added the following lines after class compilation task.

      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC"
  |           classpathref="aop.path"/>
  |  
  |       <aopc compilerclasspathref="aop.path" verbose="true">
  |          <classpath path="${classes.dir}"/>
  |          <src path="${classes.dir}"/>
  |          <include name="**/*.class"/>
  |       </aopc>
  | 
I get an error on a class where there is no annotation at all.

   [aopc] [debug] javassist.CtConstructor at 2a5330[public DeletePlanAction ()V] matches no pointcuts
     [aopc] org.jboss.aop.instrument.TransformationException: Failed to aspectize class com.company.war.commun.uc.managePlan.DeletePlanAction.  Could not find class it references com.company.war.commun.uc.managePlan.DeletePlanAction  It may not be in your classpath and you may not be getting field and constructor weaving for this class.
     [aopc] at org.jboss.aop.instrument.Instrumentor.convertReferences(Instrumentor.java:665)
     [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:719)
     [aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:909)
     [aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:821)
     [aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:345)
     [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
     [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
     [aopc] Exception in thread "main" org.jboss.aop.instrument.TransformationException: Failed to aspectize class com.company.war.commun.uc.managePlan.DeletePlanAction.  Could not find class it references com.company.war.commun.uc.managePlan.DeletePlanAction  It may not be in your classpath and you may not be getting field and constructor weaving for this class.
     [aopc] at org.jboss.aop.instrument.Instrumentor.convertReferences(Instrumentor.java:665)
     [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:719)
     [aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:909)
     [aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:821)
     [aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:345)
     [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
     [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)


I want to aspectize only the classes where there is @Prepare annotations, and define pointcuts dynamically at runtime using a xxx-aop.xml file in my deploy directory.

Can somebody tell me what I missed and what I must do to make it work ?


Regards


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

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



More information about the jboss-user mailing list