4 Replies Latest reply on Jan 14, 2008 8:49 AM by flavia.rainone

    aop precompiler ant task fails to find class reference

      Hi all,
      I'm trying to precompile my classes with AOP ant Task in order to use them with JBoss PojoCache.

      Here follows ant task log.

      aopc
      [info] Total length of filenames to be compiled is greater than 1000, listing files in --SOURCEPATH: /tmp/src22454.tmp
      [debug] Passed in instrumentor: null
      [debug] Defaulting instrumentor to: org.jboss.aop.instrument.ClassicInstrumentor
      [debug] jboss.aop.class.path is NULL
      [debug] jboss.aop.search.classpath: 'null' true
      [debug] jboss.aop.path: /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/jboss-aop.xml
      jboss.aop.path[0]: /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/jboss-aop.xml
      [deploying] file:/home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/jboss-aop.xml
      [trying to transform] rrd.gto.cbe.common.domain.PolicyItem
      [debug] There are no caller pointcuts!
      [debug] javassist.CtMethod@74eb0e95[public getOid ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@50d6273f[public setOid (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtMethod@4b9b39fc[public getValue ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@6d1b59e6[public setValue (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtConstructor@1bab50a[public PolicyItem ()V] matches no pointcuts
      [debug] rrd.gto.cbe.common.domain.PolicyItem.oid:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.value:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.oid:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.value:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] was rrd.gto.cbe.common.domain.PolicyItem converted: true
      [compiled] /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/temp/gto-cbe/rrd/gto/cbe/common/domain/PolicyItem.class
      [cannot compile] isInterface: rrd.gto.cbe.common.domain.device.DevicesRelationSpecificationKey
      [no comp needed] /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/temp/gto-cbe/rrd/gto/cbe/common/domain/device/DevicesRelationSpecificationKey.class
      [trying to transform] rrd.gto.cbe.common.domain.device.implementation.RrdDeviceKey
      [debug] There are no caller pointcuts!
      [debug] javassist.CtMethod@6e4ac4cc[public getRrdPrimaryKey ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@fe561cb6[public setRrdPrimaryKey (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtMethod@33a3ff1e[public clone ()Ljava/lang/Object;] matches no pointcuts
      [debug] javassist.CtMethod@87a44f24[public equals (Ljava/lang/Object;)Z] matches no pointcuts
      [debug] javassist.CtMethod@68af968e[public makeApplicationContext ()Ljavax/oss/ApplicationContext;] matches no pointcuts
      [debug] javassist.CtMethod@6f035bf6[public getApplicationContext ()Ljavax/oss/ApplicationContext;] matches no pointcuts
      [debug] javassist.CtMethod@c6e242ab[public setApplicationContext (Ljavax/oss/ApplicationContext;)V] matches no pointcuts
      [debug] javassist.CtMethod@2d24d5cf[public setApplicationDN (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtMethod@9a02c225[public getApplicationDN ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@31e6d0b1[public getType ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@1b64fdf3[public setType (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtMethod@1d688d34[public getPrimaryKey ()Ljava/lang/Object;] matches no pointcuts
      [debug] javassist.CtMethod@b756f664[public setPrimaryKey (Ljava/lang/Object;)V] matches no pointcuts
      [debug] javassist.CtMethod@5ee4dfcc[public makePrimaryKey ()Ljava/lang/Object;] matches no pointcuts
      [debug] javassist.CtConstructor@337d0f[public RrdDeviceKey ()V] matches no pointcuts
      org.jboss.aop.instrument.TransformationException: Failed to aspectize class rrd.gto.cbe.common.domain.device.implementation.RrdDeviceKey. Could not find class it references rrd.gto.cbe.common.domain.device.DeviceKey It may not be in your classpath and you may not be getting field and constructor weaving for this class.
       at org.jboss.aop.instrument.Instrumentor.convertReferences(Instrumentor.java:593)
       at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:646)
       at org.jboss.aop.AspectManager.translate(AspectManager.java:792)
       at org.jboss.aop.AspectManager.transform(AspectManager.java:704)
       at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:329)
       at org.jboss.aop.standalone.Compiler.compile(Compiler.java:218)
       at org.jboss.aop.standalone.Compiler.main(Compiler.java:74)
      Exception in thread "main" org.jboss.aop.instrument.TransformationException: Failed to aspectize class rrd.gto.cbe.common.domain.device.implementation.RrdDeviceKey. Could not find class it references rrd.gto.cbe.common.domain.device.DeviceKey It may not be in your classpath and you may not be getting field and constructor weaving for this class.
       at org.jboss.aop.instrument.Instrumentor.convertReferences(Instrumentor.java:593)
       at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:646)
       at org.jboss.aop.AspectManager.translate(AspectManager.java:792)
       at org.jboss.aop.AspectManager.transform(AspectManager.java:704)
       at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:329)
       at org.jboss.aop.standalone.Compiler.compile(Compiler.java:218)
       at org.jboss.aop.standalone.Compiler.main(Compiler.java:74)
      /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/gto-deploy.xml:304: Java returned: 1
       at org.apache.tools.ant.taskdefs.Java.execute(Java.java:107)
       at org.jboss.aop.ant.AopC.execute(AopC.java:320)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:357)
       at org.apache.tools.ant.Target.performTasks(Target.java:385)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
       at org.apache.tools.ant.Main.runBuild(Main.java:698)
       at org.apache.tools.ant.Main.startAnt(Main.java:199)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)
      /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/gto-deploy.xml:304: Java returned: 1
       at org.apache.tools.ant.taskdefs.Java.execute(Java.java:107)
       at org.jboss.aop.ant.AopC.execute(AopC.java:320)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:357)
       at org.apache.tools.ant.Target.performTasks(Target.java:385)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
       at org.apache.tools.ant.Main.runBuild(Main.java:698)
       at org.apache.tools.ant.Main.startAnt(Main.java:199)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)
      /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/gto-deploy.xml:304: Java returned: 1
       at org.apache.tools.ant.taskdefs.Java.execute(Java.java:107)
       at org.jboss.aop.ant.AopC.execute(AopC.java:320)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
       at org.apache.tools.ant.Task.perform(Task.java:348)
       at org.apache.tools.ant.Target.execute(Target.java:357)
       at org.apache.tools.ant.Target.performTasks(Target.java:385)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
       at org.apache.tools.ant.Main.runBuild(Main.java:698)
       at org.apache.tools.ant.Main.startAnt(Main.java:199)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)
      
      Ant build completed with 3 errors 3 warnings in 3s at 6:20:59 PM
      


      The first class is correctly weaved:
      [trying to transform] rrd.gto.cbe.common.domain.PolicyItem
      [debug] There are no caller pointcuts!
      [debug] javassist.CtMethod@74eb0e95[public getOid ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@50d6273f[public setOid (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtMethod@4b9b39fc[public getValue ()Ljava/lang/String;] matches no pointcuts
      [debug] javassist.CtMethod@6d1b59e6[public setValue (Ljava/lang/String;)V] matches no pointcuts
      [debug] javassist.CtConstructor@1bab50a[public PolicyItem ()V] matches no pointcuts
      [debug] rrd.gto.cbe.common.domain.PolicyItem.oid:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.value:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.oid:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] rrd.gto.cbe.common.domain.PolicyItem.value:Ljava/lang/String; matches pointcut: field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)
      [debug] was rrd.gto.cbe.common.domain.PolicyItem converted: true
      [compiled] /home/mbazzoni/IdeaProjects/gto/gto-deploy/gto-deploy/temp/gto-cbe/rrd/gto/cbe/common/domain/PolicyItem.class
      

      but it is a simple class two fields (Strings)

      at the 2nd class gets an exception:

      Exception in thread "main" org.jboss.aop.instrument.TransformationException: Failed to aspectize class rrd.gto.cbe.common.doma
      in.device.implementation.RrdDeviceKey. Could not find class it references rrd.gto.cbe.common.domain
      .device.DeviceKey It may not be in your classpath and you may not be getting field and constructor
      weaving for this class.



      I've double checked the class is in classpath. If I use load-time aop instrumentation it works good.

      What can the problem be?

      Thank you in advance,
      Marco.

        • 1. Re: aop precompiler ant task fails to find class reference

          I add ant build task to be more clear.

          <!--AOP COMPILATION-->
           <path id="cachelib.classpath">
           <fileset dir="${cache_lib}">
           <include name="**/*.jar"/>
           <exclude name="jboss-cache.jar"/>
           <exclude name="jboss-aop.jar"/>
           </fileset>
          
           <fileset dir="${cache_lib-50}">
           <include name="**/*.jar"/>
           </fileset>
           </path>
          
           <!-- set local properties for this build -->
           <path id="pojocache.lib.classpath">
           <fileset dir="${cache_lib}">
           <include name="jboss-common.jar"/>
           <include name="concurrent.jar"/>
           <include name="javassist.jar"/>
           <include name="trove.jar"/>
           </fileset>
           <fileset dir="${cache_lib-50}">
           <include name="jboss-cache-jdk50.jar"/>
           <include name="jboss-aop-jdk50.jar"/>
           </fileset>
           </path>
          
           <path id="jboss.aop.class.path">
           <fileset dir="${cache_lib}">
           <include name="jboss-aop-jdk50.jar"/>
           </fileset>
           </path>
          
           <!-- pre-compile directory with aopc -->
           <target name="aopc-cbe" description="Precompile aop classes">
           <unzip src="${basedir}/temp/${sar-filename}/gto-cbe.jar" dest="${basedir}/temp/gto-cbe"/>
           <!--<delete file="${basedir}/temp/${sar-filename}/gto-cbe.jar"/>-->
          
           <path id="cbe-user.classpath">
           <pathelement path="${basedir}/temp/${sar-filename}/*.jar"/>
           <pathelement path="${basedir}/temp/gto-cbe"/>
           <path refid="cachelib.classpath"/>
           </path>
          
           <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="pojocache.lib.classpath"/>
           <aopc compilerclasspathref="pojocache.lib.classpath" verbose="true">
           <src path="${basedir}/temp/gto-cbe"/>
           <aoppath path="${basedir}/jboss-aop.xml"/>
           <classpath refid="cbe-user.classpath"/>
           </aopc>
          
           <jar basedir="${basedir}/temp/gto-cbe" jarfile="${basedir}/temp/${sar-filename}/gto-cbe.jar">
           <patternset>
           <include name="**/*.*"/>
           </patternset>
           </jar>
           <delete dir="${basedir}/temp/${sar-filename}/gto-cbe"/>
           </target>
          
          


          • 2. Re: aop precompiler ant task fails to find class reference
            flavia.rainone

            The classpath tag, inside aop, must point only to the class files that will be transformed by aopc.

            Please, have a look at the build file contained in the examples directory of our release ( the path is [release-dir]/docs/aspect-framework/examples). There you will find an aopc task example. In case this is not enough, let us know.

            • 3. Re: aop precompiler ant task fails to find class reference

              Hi all,
              problem is solved. I had to change ant task build, course it was not good.
              Just have to say sorry!

              <!--AOP COMPILATION-->
               <!-- set local properties for this build -->
               <path id="cachelib.classpath">
               <fileset dir="${cache_lib}">
               <include name="**/*.jar"/>
               <exclude name="jboss-cache.jar"/>
               <exclude name="jboss-aop.jar"/>
               </fileset>
              
               <fileset dir="${cache_lib-50}">
               <include name="**/*.jar"/>
               </fileset>
               </path>
               <path id="pojocache.lib.classpath">
               <fileset dir="${cache_lib}">
               <include name="jboss-common.jar"/>
               <include name="concurrent.jar"/>
               <include name="javassist.jar"/>
               <include name="trove.jar"/>
               </fileset>
               <fileset dir="${cache_lib-50}">
               <include name="jboss-cache-jdk50.jar"/>
               <include name="jboss-aop-jdk50.jar"/>
               </fileset>
               </path>
              
               <path id="jboss.aop.class.path">
               <fileset dir="${cache_lib}">
               <include name="jboss-aop-jdk50.jar"/>
               </fileset>
               </path>
              
               <path id="temp.cbe-user.classpath">
               <fileset dir="${basedir}/temp/${sar-filename}">
               <include name="*.jar"/>
               <exclude name="gto-*.jar"/>
               </fileset>
               <path refid="cachelib.classpath"/>
               </path>
              
               <!-- pre-compile directory with aopc -->
               <target name="aopc-cbe" description="Precompile aop classes">
               <unzip src="${basedir}/temp/${sar-filename}/gto-cbe.jar" dest="${basedir}/temp/gto-cbe"/>
               <delete file="${basedir}/temp/${sar-filename}/gto-cbe.jar"/>
               <path id="cbe-user.classpath">
               <fileset dir="${basedir}/temp/${sar-filename}">
               <include name="gto-*.jar"/>
               </fileset>
               <pathelement path="${basedir}/temp/gto-cbe"/>
               <path refid="temp.cbe-user.classpath"/>
               </path>
              
               <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="pojocache.lib.classpath"/>
               <aopc compilerclasspathref="pojocache.lib.classpath" verbose="true">
               <src path="${basedir}/temp/gto-cbe"/>
               <aoppath path="${basedir}/jboss-aop.xml"/>
               <classpath refid="cbe-user.classpath"/>
               </aopc>
              
               <jar basedir="${basedir}/temp/gto-cbe" jarfile="${basedir}/temp/${sar-filename}/gto-cbe.jar">
               <patternset>
               <include name="**/*.*"/>
               </patternset>
               </jar>
               <delete dir="${basedir}/temp/${sar-filename}/gto-cbe"/>
               </target>
              


              • 4. Re: aop precompiler ant task fails to find class reference
                flavia.rainone

                I'm glad it works now :).