I tried to configure load-time weaving (for doing profiling with Perf4J) in the next way:
1) I added aop.xml
to META-INF
folder. When deployed, META-INF is placed in the artifact root directory (i.e. MyAppDeployed/META-INF
).
2) I put aspectjrt-1.6.1.jar
, aspectjweaver-1.6.1.jar
, commons-jexl-1.1.jar
, commons-logging.jar
to the Tomcat/lib
folder (at first I tried MyAppDeployed/WEB-INF/libs
but it also didn't work).
3) I added -javaagent:C:\apache-tomcat-6.0.33\lib\aspectjweaver-1.6.1.jar
to VM options when starting Tomcat.
4) My aop.xml
:
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<aspects>
<aspect name="org.perf4j.log4j.aop.TimingAspect"/>
</aspects>
<weaver options="-verbose -showWeaveInfo">
<include within="com.mypackages.MyClass"/>
</weaver>
</aspectj>
I don't see any signs that load-time weaving happens. Neither error-reports nor necessary results. The only error message I have is:
Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file: C:\apache-tomcat-6.0.33\lib\wrong-jar.jar
in a case when I do a mistake in a aspectjweaver-1.6.1.jar
name when specify a javaagent parameter. If it's written correctly - no error messages are printed.
Any ideas, what am I doing wrong?
P.S. I use Java 5, and I tried the same things with 1.5.4
version of the aspectj with exactly the same results.