Re: [aspectwerkz-user] Custom annotation is not wrapped in AnnotationInfo
Kenji Nakamura <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
Alex, Now I see the advice specified as annotation. However, I got the same error when I deployed the jar containing annotated class. kenjin@omega: java org.codehaus.aspectwerkz.annotation.AnnotationC -verbose -src src/java/main -classes target/classes AnnotationC::INFO - parsing source dirs: AnnotationC::INFO - src/java/main AnnotationC::INFO - compiling annotations... AnnotationC::INFO - note: if no output is seen, then nothing is compiled AnnotationC::INFO - class [com.example.deliver.ProgressBarLoggingAspect] AnnotationC::INFO - class [com.example.token.InstanceLogFilterAspect] AnnotationC::INFO - around advice [dynamicFilterLog(JoinPoint) :: call(* com.example.util.logging.Logger.info(..))] AnnotationC::INFO - compiled classes written to target/classesAnnotationC::INFO - compilation successful Should I use the notation without parenthesis and double quote from now on, or is it just an experiment? Thanks, -kenji On Apr 22, 2005, at 7:08 AM, Alexandre Vasseur wrote: > Ok we don't see the annotation there. > > Can you try with this syntax: > (no parenthesis and double quote) > > /** > * @Around call(* com.example.util.logging.Logger.info(..)) > */ > > > Alex > > > On 4/22/05, Kenji Nakamura <[email protected]> wrote: >> Alex, >> >> Verbose flag was specified in the ant task. >> I also ran from command line just in case, and got the same output >> >> kenjin@omega: java org.codehaus.aspectwerkz.annotation.AnnotationC >> -verbose -src src/java/main -classes target/classes -dest /tmp/test >> AnnotationC::INFO - parsing source dirs: >> AnnotationC::INFO - src/java/main >> AnnotationC::INFO - compiling annotations... >> AnnotationC::INFO - note: if no output is seen, then nothing is >> compiled >> AnnotationC::INFO - class >> [com.example.deliver.ProgressBarLoggingAspect] >> AnnotationC::INFO - class [com.example.token.InstanceLogFilterAspect] >> AnnotationC::INFO - compiled classes written to >> /tmp/testAnnotationC::INFO - compilation successful >> >> I'm interested in the solution with backport 175. It would be great if >> you show me how to use it. >> >> Thanks, >> >> -kenji >> >> On Apr 22, 2005, at 1:09 AM, Alexandre Vasseur wrote: >> >>> Can you try to use the "-verbose " flag during the AnnotationC phase. >>> >>> If you can, I would advise to use http://backport175.codehaus.org to >>> compile the annotation to regular Java 5 binary format. The next >>> version of AspectWerkz will precisely use our backport project >>> instead >>> of the AnnotationC things. >>> Let me know and I'll send a short how-to. >>> >>> >>> Alex >>> >>> On 4/21/05, Kenji Nakamura <[email protected]> wrote: >>>> Hi, >>>> >>>> I'm working on integrating AspectWerkz2.0 into jboss 3.2.6 and Apple >>>> JDK1.4.2 with prepared-classpath weaving. >>>> I could use aspects with XML definition, but have problem with >>>> annotations. >>>> The source was processed with AnnotationC ant task (via maven.xml). >>>> How should I interpret the error message? >>>> >>>> Thanks in advance, >>>> >>>> AnnotationC maven.xml >>>> <goal name="build:aw2annotationc" >>>> description="Run aspectwerkz 2 annotation compiler" > >>>> <ant:taskdef name="annotationc" >>>> >>>> classname="org.codehaus.aspectwerkz.annotation.AnnotationCTask" >>>> classpathref="maven.dependency.classpath" /> >>>> <ant:annotationc verbose="true" >>>> >>>> properties="${basedir}/src/resources/main/annotation.properties" >>>> destdir="${basedir}/target/classes" >>>> copytodest="**/*.class"> >>>> <ant:src path="${basedir}/src/java/main" /> >>>> <ant:classpath path="${basedir}/target/classes" /> >>>> </ant:annotationc> >>>> </goal> >>>> >>>> AnnotationC output >>>> AnnotationC::INFO - parsing source dirs: >>>> AnnotationC::INFO - >>>> /Users/user/repository/modules/aspect/src/java/main >>>> AnnotationC::INFO - compiling annotations... >>>> AnnotationC::INFO - note: if no output is seen, then nothing is >>>> compiled >>>> AnnotationC::INFO - class >>>> [com.example.deliver.ProgressBarLoggingAspect] >>>> AnnotationC::INFO - class >>>> [com.example.token.InstanceLogFilterAspect] >>>> AnnotationC::INFO - compiled classes written to >>>> /Users/user/repository/modules/aspect/target/classes >>>> AnnotationC::INFO - compilation successful >>>> >>>> StackTrace >>>> java.lang.RuntimeException: Custom annotation is not wrapped in >>>> AnnotationInfo: org.codehaus.aspectwerkz.annotation.AnnotationInfo >>>> [sun.misc.Launcher$AppClassLoader@53ba3d / >>>> org.codehaus.classworlds.RealmClassLoader@b3b6a6 / >>>> org.jboss.mx.loading.UnifiedClassLoader3@502283{ >>>> url=file:/Users/user/jboss/server/foobar/tmp/deploy/tmp6798jboss- >>>> service.xml ,addedOrder=2} >>>> at >>>> org.codehaus.aspectwerkz.annotation.instrumentation.asm.CustomAttrib >>>> ut >>>> eH >>>> elper.extractCustomAnnotation(CustomAttributeHelper.java:59) >>>> at >>>> org.codehaus.aspectwerkz.annotation.instrumentation.asm.CustomAttrib >>>> ut >>>> eH >>>> elper.extractCustomAnnotation(CustomAttributeHelper.java:43) >>>> at >>>> org.codehaus.aspectwerkz.annotation.instrumentation.asm.AsmAnnotatio >>>> nH >>>> el >>>> per.extractAnnotations(AsmAnnotationHelper.java:271) >>>> at >>>> org.codehaus.aspectwerkz.annotation.instrumentation.asm.AsmAnnotatio >>>> nH >>>> el >>>> per$MethodAnnotationExtractor.visitMethod(AsmAnnotationHelper.java: >>>> 126) >>>> at >>>> org.codehaus.aspectwerkz.org.objectweb.asm.ClassReader.accept(Unknow >>>> n >>>> Source) >>>> at >>>> org.codehaus.aspectwerkz.reflect.impl.asm.AsmMethodInfo.getAnnotatio >>>> ns >>>> (A >>>> smMethodInfo.java:213) >>>> at >>>> org.codehaus.aspectwerkz.annotation.instrumentation.asm.AsmAnnotatio >>>> ns >>>> .g >>>> etAnnotations(AsmAnnotations.java:127) >>>> at >>>> org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.parsePoin >>>> tc >>>> ut >>>> Attributes(AspectAnnotationParser.java:210) >>>> at >>>> org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.parseMeth >>>> od >>>> At >>>> tributes(AspectAnnotationParser.java:182) >>>> at >>>> org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.doParse(A >>>> sp >>>> ec >>>> tAnnotationParser.java:100) >>>> at >>>> org.codehaus.aspectwerkz.annotation.AspectAnnotationParser.parse(Asp >>>> ec >>>> tA >>>> nnotationParser.java:57) >>>> at >>>> org.codehaus.aspectwerkz.definition.DocumentParser.parseAspectElemen >>>> ts >>>> (D >>>> ocumentParser.java:433) >>>> at >>>> org.codehaus.aspectwerkz.definition.DocumentParser.parsePackageEleme >>>> nt >>>> s( >>>> DocumentParser.java:353) >>>> at >>>> org.codehaus.aspectwerkz.definition.DocumentParser.parseSystemElemen >>>> t( >>>> Do >>>> cumentParser.java:238) >>>> at >>>> org.codehaus.aspectwerkz.definition.DocumentParser.parseSystemElemen >>>> ts >>>> (D >>>> ocumentParser.java:181) >>>> at >>>> org.codehaus.aspectwerkz.definition.DocumentParser.parse(DocumentPar >>>> se >>>> r. >>>> java:168) >>>> at >>>> org.codehaus.aspectwerkz.definition.XmlParser.parseNoCache(XmlParser >>>> .j >>>> av >>>> a:178) >>>> at >>>> org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.regist >>>> er >>>> Cl >>>> assLoader(SystemDefinitionContainer.java:139) >>>> at >>>> org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.getHie >>>> ra >>>> rc >>>> hicalDefinitionsFor(SystemDefinitionContainer.java:317) >>>> at >>>> org.codehaus.aspectwerkz.definition.SystemDefinitionContainer.getDef >>>> in >>>> it >>>> ionsFor(SystemDefinitionContainer.java:225) >>>> at >>>> org.codehaus.aspectwerkz.transform.inlining.ContextImpl.<init>(Conte >>>> xt >>>> Im >>>> pl.java:99) >>>> at >>>> org.codehaus.aspectwerkz.transform.inlining.InliningWeavingStrategy. >>>> ne >>>> wC >>>> ontext(InliningWeavingStrategy.java:259) >>>> at >>>> org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor._preProce >>>> ss >>>> (A >>>> spectWerkzPreProcessor.java:166) >>>> at >>>> org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor.preProces >>>> s( >>>> As >>>> pectWerkzPreProcessor.java:148) >>>> at >>>> org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineCla >>>> ss >>>> 0P >>>> re(ClassPreProcessorHelper.java:107) >>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:539) >>>> at >>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java: >>>> 123) >>>> at >>>> java.net.URLClassLoader.defineClass(URLClassLoader.java:251) >>>> at >>>> java.net.URLClassLoader.access$100(URLClassLoader.java:55) >>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:194) >>>> at java.security.AccessController.doPrivileged(Native >>>> Method) >>>> at >>>> java.net.URLClassLoader.findClass(URLClassLoader.java:187) >>>> at >>>> org.jboss.mx.loading.UnifiedClassLoader.findClass(UnifiedClassLoader >>>> .j >>>> av >>>> a:520) >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:289) >>>> >>>> Here is the aop.xml. >>>> <aspectwerkz> >>>> <system id="app"> >>>> <package name="com.example.token"> >>>> <aspect >>>> class="InstanceLogFilterAspect"></aspect> >>>> </package> >>>> </system> >>>> </aspectwerkz> >>>> >>>> This is the source with annotation. >>>> >>>> /** >>>> * @Around("call(* com.example.util.logging.Logger.info(..))") >>>> */ >>>> public Object dynamicFilterLog(JoinPoint sjp) throws Throwable >>>> { >>>> log.info("=========== Intercepted by >>>> InstanceLogFilterAspect. >>>> ============== "); >>>> >>>> return sjp.proceed(); >>>> } >>>> >>>> >>> >>> >> >> > >