Hi Florian,
On a quick look at the aspect, it is a bit odd that it specifies the parameter value to the method in the pointcut: before(): execution(public * WebService.HelloWorldService.echo("yop") ){ I wouldn’t expect that to work - I’m surprised it compiles since when I try I get an error:
no match for this type name: foo [Xlint:invalidAbsoluteTypeName] before(): execution(* n("foo")) {} ^^ [Xlint:invalidAbsoluteTypeName]
Your other advice against the logHellow() pointcut looks reasonable to me, and the pointcut for that looks right:
pointcut logHellow() : execution( * WebService.HelloWorldService.Hellow(..)); after() : logHellow() {
System.out.println("APRES Hellow");
} In your ant script I see a section that compiles the source code for the class “target compile” and a section that compiles the aspect “target compileAJ” but I don’t see anything that weaves them together, am I overlooking it? Are you trying to use loadtime weaving or compile time weaving?
If compiling time weaving (weaving as you compile), I’d expect either the java source and AspectJ source to be compiled together by iajc, or I’d expect the compileAJ step to be fed the compiled java class files as input (using an ‘inpath’ setting perhaps) and then it would weave into them and produce a woven copy.
If you are loadtime weaving then I’d expect to sea an aop.xml file somewhere naming the aspect and then the app server to be launched with the AspectJ weaver java agent. I find compile time weaving easier to get my head around, but as I say I don’t quite see that happening here. Are you getting warnings at compile time that your advice does not match anywhere? I’d expect that for the compileAJ task (although I’d also expect a compile time error about that pointcut which specifies a string literal in the pointcut _expression_).
cheers, Andy |