All, I have tried to find a solution to this but somehow it is illuding me. I am, on an experimental basis trying to instrument H2 driver to print out some traces. The aspects are as follows:
pointcut getMajorVersion_pointcut() :
call(int org.h2.Driver.getMajorVersion());
before() : getMajorVersion_pointcut() {
System.out.println("Before Advice:: driver executed");
}
This works perfectly and I get the output "Before Advice:: driver executed".
However, the other advice is making problems:
pointcut accept_pointcut(String url) :
call(boolean org.h2.Driver.acceptsURL(String)) && args(url);
before(String url) : accept_pointcut(url) {
System.out.println(url);
}
Eclipse is flagging "Advice defined in ... has not been applied"
The screenshot is given below:
As can be seen in the left panel, H2 driver has the method with the signature. Could anyone point me in the right direction.
Where is the code calling Driver.acceptsURL(String)
? It must be somewhere in your woven (application) code. If the call is made from within the H2 library, it will not be intercepted because that code it outside the control of AspectJ. If you want to change that circumstance, you need to