TroubleShooting
Follow the installation instructions carefully! JAsCo is only tested and maintained on Windows 2000/XP and Linux compatible systems, JAsCo might fail on other Operating Systems .
SOME HINTS:
make sure the java bin directory is in your PATH environment variable, so javac and java have to be executable from the prompt!
Don’t use spaces in directory names (e.g. not good: /var/test/my documents/JAsCo), JAsCo does not cope well with spaces.
Make sure . (the current directory) is in your classpath!
NEW: make sure to use
JDK 1.5! Check this by typing
java version in the shell or by configuring the JRE options of your runner when using Eclipse.
1. COMPILE-TIME PROBLEMS
1.1 I get a ClassFormatError (truncated class file) exception when running the JAsCo tools.
This error stems from certain unzip programs that do not unpack the JAsCo zip file correctly. As such, a class file with 0 bytes is generated which is of course not valid. Up till now, only some linux based unzip programs seem to be causing this problem. Solution: use another unzip tool
1.2 The transformBean tool does not appear to work.
Possible reasons:
JAsCo does not support classes declared without a package, when you transform such classes, transformBean will fail!
Also make sure the classes are located in the correct subdirectories as specified by their package declaration. See tools documentation for more info.
1.3 Java 1.5 features such as generics do not work
Make sure to compile using the target 1.5 flag. In order to change the target and source code VM version, use the -target flag for the JAsCo aspect, connector and traversal connector compilers. See tools documentation for more info. JAsCo supports Java 1.5 features like annotations and generics fully since from JAsCo 0.8. Notice that since 0.8.5M2, 1.5 is the default target VM, so there shouldn’t be a problem when using the latest version.
1.4 My aspects and connectors don't compile
Do you have a JVM 1.5 installed as the default VM? JAsCo compiles per default to 1.5 Java code since 0.8.5M2, compilation will fail when the current VM is not 1.5. Check this by running javac -version on the command prompt. When you don’t want to use 1.5, use the -target flag for the JAsCo aspect, connector and traversal connector compilers to specify compatible 1.4 target code.
2. START-UP PROBLEMS
2.1 I get a ClassNotFoundException: com/sun/jdi/Bootstrap
This means the tools.jar is not in your classpath. The tools.jar is normally located in the lib directory of your jdk installation. Notice that the tools.jar is not availabe in the java runtime environment (JRE), you need to install the JDK!
2.2 JAsCo HotSwap 1 does not work
On 1.4, hotswapping the classloader might cause a weird system error (ClassCastException in some peer class). In Java 1.5, this problem seems to be disappeared. So, either use Java 1.5 or disable the classloader hotswapping by launching the VM with the following option: -Djasco.hotswap.replace.classloader=false. More information about this option can be found here.
2.3 My application does not start for other reasons
Check the your virtual machine version, JAsCo requires 1.4 when preprocessing the beans, 1.4 for HotSwap 1 and 1.5 for HotSwap 2. We encourage to either employ the preprocessor or HotSwap 2, HotSwap 1 is discontinued. In general, it is a good idea to install the latest virtual machine if possible.
3. RUN-TIME PROBLEMS
3.1 My aspects are not triggered
This problem can have several reasons, you can try the following:
try to use the introspect tool in order to introspect which connectors are loaded for a given classpath. Check whether your connector seems to be loaded and is declared static(!).
you can try to enable the jasco debug option to get more information on which aspects are found for each joinpoint.
If that doesn’t help, it might be a JAsCo Jutta or run-time weaver error, so you can try to disable the Jutta just-in-time compiler and the run-time weaver. The normal interpreter is more mature and should be correct. If the problem persists, it’s probably not a JAsCo error.
3.2 I want to optimize my aspects
For maximum performance, make sure to follow the following guidelines:
HotSwap 1 does not scale very well, so for large applications, you will notice a considerable slowdown. Use either the preprocessor or HotSwap 2. When preprocessing beans using the TransformBean tool, a run-time overhead for the complete system is experienced, so employ HotSwap 2 and if possible enable the run-time weaver for solving this. Do not run the preprocessed beans with HotSwap 2 if you want to achieve maximum run-time performance, because these beans are never hotswapped!
When aspects are very frequently added or removed, HotSwap 2 and certainly when the run-time weaver is enabled, a considerable overhead can be noticed for trap insertion or weaving. Either preprocess joinpoints where aspects are frequently added or removed, or write a heuristics function so that no run-time wewaving is performed at these joinpoints.
Avoid plain around advices when possible, before and after advices execute more than 50% faster!
Use proceed() as much as possible in around advices. Avoid to employ the proceed with arguments and certainly avoid to employ one of the invoke* methods on the thisJoinPoint keyword.
When implementing aspects also avoid to employ dynamic information such as the arguments of the method joinpoint or the thisJoinPointObject keyword if possible.
3.3 I get a "bus error" in Mac OS X
This is a bug in the current JVM of MacOS that occurs when the javaagent argument is specified using a relative path. Specifying the jasco.jar javaagent using the absolute path solves this.
3.4 My application crashes - IncompatibleClass
You need Java 1.5 for running JAsCo!