I tried setting up temporary weaving (to perform profiling using Perf4J) as follows:
1) I added the aop.xml folder to META-INF . When deployed, META-INF is placed in the root directory of the artifact (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 in the Tomcat/lib folder (I tried MyAppDeployed/WEB-INF/libs , but it also did not work).
3) I added the options -javaagent:C:\apache-tomcat-6.0.33\lib\aspectjweaver-1.6.1.jar to the VM 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 see no signs that interweaving in time is occurring. No error reports, no required 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 case of an error in the name aspectjweaver-1.6.1.jar when specifying the javaagent parameter. If it is correctly written, error messages are not printed.
Any ideas what I'm doing wrong?
PS I use Java 5 and I tried the same things with 1.5.4 aspectj version with exactly the same results.
java tomcat aspectj load-time-weaving perf4j
Roman
source share