-
1. Re: annotationc on jdk 1.4.2
bill.burke Feb 15, 2005 3:19 PM (in response to natebowler)make sure your references to the annotation are fully qualified in your pointcut expressions. annotations are interfaces.
-
2. Re: annotationc on jdk 1.4.2
natebowler Feb 15, 2005 4:49 PM (in response to natebowler)OK, I've added the package. But still nothing. How can I verify if the Annotations are being added?
The only way I can get the Ant Task to run without a parse error is by changing the src tag to.
src
fileset dir="${src.dir}"
include name="*.java"/
/fileset
/src
in order to filter out other files.
I assume my error is either:
1- the Annotations are not being marked correctly.
2- Or they are, and my jboss-aop.xml isn't defined correctly to pick them up.
I'm leaning towards #1 being the problem, but can I verify this? If I do an XML output, I get an empty metadata-aop.xml file (well, tags with nothing in them). -
3. Re: annotationc on jdk 1.4.2
bill.burke Feb 15, 2005 5:11 PM (in response to natebowler)I should probably create an annotationc task to show annotations.
but, here's how you can do it:
put javassist.jar, jboss-aop.jar, trove,.jar, etc... into your classpath
add your classes to the classpath as well.
do:
java org.jboss.aop.annotation.util.FindAnnotations fully.qualified.class.name
where fully.qualified... is the classname
It will print out a bunch of stuff and show you where annotations lie.
Bill -
4. Re: annotationc on jdk 1.4.2
bill.burke Feb 15, 2005 5:12 PM (in response to natebowler)P.S. Apoloogies for all your troubles.
-
5. Re: annotationc on jdk 1.4.2
natebowler Jul 20, 2005 7:17 PM (in response to natebowler)Bill,
Sorry to take so long in my response, but this was put on hold and I am just now getting back into it. I have followed your instructions and yes, I can pring out A LOT of information. I'm not sure what this is, but I can't see any information regarding Annotations.
Just to sum up again, I am using JDK 1.4.2, and I am trying to annotate my code. The annotationc tag in my Ant file is as follows and runs successfully:
[annotationc compilerclasspathref="redrock.aop.classpath.path.id" classpath="${ejb.dest.dir}" xml="true"]
[src ]
[fileset dir="${src.dir}"]
[include name="*.java"/]
[/fileset]
[/src]
[/annotationc]
I have an interface named "biz.OptimisticLockRetry". The method I want to have intercepted is annotated using:
/**
* @@biz.OptimisticLockRetry
**/
My pointcut in jboss-aop.xml is defined using:
[pointcut name="optimisticLockRetryMethods" expr="execution(public static * *->@biz.OptimisticLockRetry(..))"/]
Is there something obvious I'm missing here? -
6. Re: annotationc on jdk 1.4.2
kabirkhan Jul 20, 2005 8:00 PM (in response to natebowler)Instead of xml=true in the annotationc tag, try bytecode=true
You can find more info here:
http://docs.jboss.com/aop/1.3/aspect-framework/reference/en/html/annotationcompiler.html#annotationcompiler-compiler -
7. Re: annotationc on jdk 1.4.2
natebowler Jul 21, 2005 4:39 PM (in response to natebowler)I'm running out of ideas here, there has got to be something I'm missing but as I keep going through the checklist I'm not catching it. I have changed my ant file to:
[taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpath="${aop.classpath}"/]
[annotationc compilerclasspathref="redrock.aop.classpath.path.id" classpath="${ejb.dest.dir}" bytecode="true"]
[src]
[fileset dir="${src.dir}"]
[include name="*.java"/]
[/fileset]
[/src]
[/annotationc]
But, I still get no encodings. Everything else is the same as my previous post. The Ant output is:
"[annotationc] Working directory ignored when same JVM is used."
Also, I am concerned that when I added the "verbose="true"" attribute to the annotationc tag, I got an error saying "verbose was not supported".
I am using JBoss AOP 1.3 with JDK 1.4.2 on Windows XP.
If it helps, the Java interface is defined as:
package biz;
public interface OptimisticLockRetry {}
As a side note, when I had the "xml="true"" attribute set, my resultant XML file was empty . It's just not picking up these annotations.
The "verbose not supported" concerns me though. Should I start looking at classpath/library issues?
Nate -
8. Re: annotationc on jdk 1.4.2
bill.burke Jul 21, 2005 4:54 PM (in response to natebowler)You must have your classes compiled before you run annotationc. These classes must be available in your classpath. These classes cannot be in a JAR, they must be in a directory classpath.
-
9. Re: annotationc on jdk 1.4.2
natebowler Jul 21, 2005 5:11 PM (in response to natebowler)Yes I got that. If it helps, this is my javac call:
[javac debug="on"
destdir="${ejb.dest.dir}"
classpath="${web.classpath}"
optimize="off"
deprecation="off"
includes="**"
excludes="test/**,benchmarking/**,aspect/**"]
[src path="${src.dir}"/]
[src path="${gensrc.dir}"/]
[/javac]
The target this tag is in is called prior to the target running [annotationc].
${ejb.dest.dir} is a directory.It *is* named using the ".jar" suffix per JBoss deployment specifications, I' m not sure if that makes any difference.
Is the fact that the [annotationc] tag is giving an error on "verbose" a cause of concern (as in I've got a bad version or an old verison)? Also, if I don't use a [fileset] inside my [src] tag I get a parse error, which I'm not sure if CVS files are causing it to choke or what.
Again, I'm just trying to mention as much as possible to see if anything comes across as significant. -
10. Re: annotationc on jdk 1.4.2
natebowler Jul 21, 2005 11:42 PM (in response to natebowler)Ok, I got it working.
The way I used the [annotationc] with a [fileset] did not work. My files were not being examined. When I changed it to use an [include] tag with the [src] tag, it started to examine the files.
Once this worked, I discovered I had several methods marked that had comments AFTER the markup @@biz.OptimisticLockRetry. I guess you CAN'T have anything after this or you get a parse error. :)
This is fairly obvious, I suppose, but it was easy to fix once I started getting messages.
At any rate, thanks for the help. It's working great.