General

What is AspectWerkz?

AspectWerkz is a dynamic, lightweight and high-performant AOP/AOSD framework for Java.

How can I use it without starting up the application or application server with the command line tool?

You can post-process (instrument/transform) your source files before use. See the Startup and transformations section.

You can also use one of the several options to start your application with AspectWerkz enabled without the command line tool.

For a complete discussion on this topic, see the Online architecture section.

What does the aspectwerkz command line tool do?

Basically it just invokes the normal java command line tool by calling a class that intercepts the normal class loading scheme before it invokes the main class specified. This means that you can just substitute the normal call to:

java -cp .. -D.. mainclass args with: aspectwerkz -cp .. -D.. mainclass args and everything should work as before, the only difference is that all classes that are loaded will be transformed (if they are defined to). You can even hack the startup script of your favorite application server and start it up using the aspectwerkz command line tool as outlined above, or using directly aspectwerkz-core- version.jar facilities.

The key advantage of the command line tool when you startup your application thru it is that it provides an autodetection mechanism for java 1.3 / java 1.4 support. The online architecture differs between these two java version.

For full control on the behavior of AspectWerkz online mode (dump class, verbosity), you should avoid using the command line tool.

Read more in the Online architecture section.

If I use the post-processor, I'll lose the possibility to change my configurations at runtime, right?

Actually no. You will still be able to to all the things covered in the Hot deployment section of the documentation. Like swapping the implementation of a Introduction or change the order or of advices and so on. The only things you can not do are introducing new Introductions and advise new methods.

Is there any DTD or XML Schema I can use to write the AspectWerkz XML definition fil?

The DTD is provided since 0.8. Each distribution comes with a bundled DTD so that it is not looked for on the web at runtime.

When you write your XML definition file, add the following at the top of your XML.

                        <!DOCTYPE aspectwerkz PUBLIC
    "-//AspectWerkz//DTD 1.0//EN"
    "http://aspectwerkz.codehaus.org/dtd/aspectwerkz_1_0.dtd">
                    
The DTD for the latest release is also always referenced with
                        <!DOCTYPE aspectwerkz PUBLIC
    "-//AspectWerkz//DTD//EN"
    "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
                    

Why can't I build AspectWerkz in a directory whose name contains whitespaces?

The Ant or Maven based build will fail if the ASPECTWERKZ_HOME (basedir) is a directory whose name contains whitespace(s). This would drastically complexify the script if we had to escape the whitespaces and thus this is not supported for convenience reason.

The AspectWerkz online and offline mode (command line tool etc) support path whose elements contains whitespace(s) in their names.

BEA integration

Does AspectWerkz support BEA JRockit?
AspectWerkz supports BEA JRockit thru a dedicated module wich relies on a low level BEA API. It makes AOP integration on BEA JRockit much easier than for HotSpot. Read more.
I am having troubles with WebLogic Server / Integration when using AspectWerkz, with a "getEncoding" error !
This is a known conflict between piccolo.jar that ships with AspectWerkz and the WebLogic 8.1 product line. Rename the lib/piccolo.jar in lib/piccolo.jar.IGNORE in the AspectWerkz distribution.

Other

Does AspectWerkz supports custom JRE like IBM ones?
AspectWerkz supports all java environment thru offline mode. With online mode, AspectWerkz hooks at the class loader level. AspectWerkz provides a transparent mechanism that support the IBM JRE which bundles a specific java.lang.ClassLoader.
Does AspectWerkz support BEA JRockit?
AspectWerkz supports BEA JRockit thru a dedicated module wich relies on low level BEA API.
Does AspectWerkz support Java 1.3?
Yes it does.

First add the piccolo-1.03.jar file in your JAVA_HOME/jre/lib/ext/.

You will need to add xerces.jar as well at this location.

Second, start your VM with the extra option -Djavax.xml.parsers.SAXParserFactory=com.bluecast.xml.JAXPSAXParserFactory.

If you encounter troubles in your environment (IDE etc), just remove the piccolo-1.03.jar file from your JAVA_HOME/jre/lib/ext/ when done.