Wednesday, September 3, 2003

AspectWerkz has support for IBM

(imported from http://blogs.codehaus.org/people/avasseur, read comments there)

I managed to bring IBM jdk support to AspectWerkz for on the fly weaving.
Read more on project blog

IBM bundles a specific JRE that I did not planned when hacking the JVM hook architecture that allow on the fly weaving, so some of you reported JVM crash. Now it is fixed (in CVS HEAD) and for other exotic VM, an explicit error message should be reported.

If you have issues with it, please provide feedback. The IBM jre (at least 1.3.x) seems to have many issues as regards jars packaging. f.e I had to remove index.lst from meta-inf/ in two third parties jars for it to work...

debug your AOP with AspectWerkz

(imported from http://blogs.codehaus.org/people/avasseur, read comments there)

Using the latest development of AspectWerkz, and thus the recently released 0.8.1, debugging step by step your aspects is made easy.

Indeed we now have support for standard IDE debugging, so that bytecode weaving process can be followed step by step as regular java.

Then when your weaved application is running, you can set breakpoints on your advices and debug the app as usual, as plain java, as you are probably used to do it.
Though the IDE does not have access to the source of the weaved classes, you can set breakpoints in the original method affected by the pointcuts where aspects are bounded.

Here are some screenshot with IntelliJ.

click to enlarge




Here is a short how-to:

Create a new project in your IDE, with AspectWerkz source distribution and your own sources.

Configure all classpath as needed.

On java 1.3, copy piccolo-xy.jar in your JAVA_HOME/jre/lib/ext/ (and remove it after since Ant does not like to have it there...)

Run or debug the class org.codehaus.aspectwerkz.hook.impl.WeavingClassLoader as usual with your IDE.
Use this class as a java command replacement.

Do not forget to define the -Daspectwerkz.definition.file

For example I am running it with the following to run a single unit test.
JVM arg = -Daspectwerkz.definition.file=src\test\aspectwerkz-test.xml -Daspectwerkz.transform.verbose=yes -Daspectwerkz.transform.dump=test..*


Program parameter = test.DynamicDeploymentTest


Working directory = my AspectWerkz home directory