Difference between revisions of "JavaMOP4 Troubleshooting"

From FSL
Jump to: navigation, search
(patching AspectJ)
m (update ajc patch's link)
Line 29: Line 29:
 
====patching AspectJ====
 
====patching AspectJ====
 
# Go to your local AspectJ git repository, and checkout the commit "''Fix 443355: interface super references''" by executing the command below (You may need to pull to get the latest update before you can perform the operation below): <code>git checkout dddd1236cd21982a07f887ff7fa5d484ebc3b86c</code>
 
# Go to your local AspectJ git repository, and checkout the commit "''Fix 443355: interface super references''" by executing the command below (You may need to pull to get the latest update before you can perform the operation below): <code>git checkout dddd1236cd21982a07f887ff7fa5d484ebc3b86c</code>
# Download the "''stdAJC_dddd123.patch''" from [https://drive.google.com/file/d/0B6IHEA04Ksa_elpDMDBCUWZnNm8/view here] and place it in the above AspectJ repository's top level.
+
# Download "''stdAJC_dddd123.patch.zip''" from [[Media:stdAJC_dddd123.patch.zip |here]], extract "''stdAJC_dddd123.patch''" from the zip and place it inside the above AspectJ repository's top level.
 
# Apply the patch by executing: <code>git apply --whitespace=nowarn stdAJC_dddd123.patch</code>
 
# Apply the patch by executing: <code>git apply --whitespace=nowarn stdAJC_dddd123.patch</code>
 
# Build the AspectJ project using ant. You can execute the command <code>ant</code> at the top level of the AspectJ's repository.
 
# Build the AspectJ project using ant. You can execute the command <code>ant</code> at the top level of the AspectJ's repository.

Revision as of 15:13, 27 October 2014

Contents

I get error when I use Xbootclasspath, what should I do ?

Instrumenting with Xbootclasspath can lead to errors if the right jar files are not passed to the java command after weaving. For example, one may see the following error message when running something with Xbootclasspath:

Error occurred during initialization of VM
java.lang.NoSuchMethodError: sun.misc.JavaLangAccess.registerShutdownHook(ILjava/lang/Runnable;)V
    at java.io.Console.<clinit>(Console.java:493)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at sun.misc.SharedSecrets.getJavaIOAccess(SharedSecrets.java:93)
    at java.lang.System.initializeSystemClass(System.java:1089)

The minimum necessary (for JDK 1.6.0.24 on a Linux OS) is -Xbootclasspath/p:directoryWithInstrumentedJRE:/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/rt.jar

I get "Code size too big" error when using AspecJ Compiler, what should I do?

In some extreme cases when you need to monitor classes with huge methods or the intended pointcuts are very dense in some method, you may encounter some error while using standard AspectJ compiler to

weave code; such as:
/YourBigClass.java [error] problem generating
method YourBigClass.bigMethod: Code size too big: 65613.
This kind of error is caused by Java's 64-KB maximum method size constraint. If a method of the monitored class has already been very big, then after inserting the advices at the pointcuts, it may violate the 64-KB-constraint. To address this issue, we provide a patch for the standard AspectJ source code to solve this problem quickly. Please follow the instructions below to install the patch (Please backup your AspectJ before applying the patch).

Prerequisites for using the patch

  • AspectJ source code
If you have not checked out the source code of AspectJ, you can go to here to check it out.
  • Ant
If you have not installed the program ant yet, then go to here to download and install the latest ant program.

patching AspectJ

  1. Go to your local AspectJ git repository, and checkout the commit "Fix 443355: interface super references" by executing the command below (You may need to pull to get the latest update before you can perform the operation below):
    git checkout dddd1236cd21982a07f887ff7fa5d484ebc3b86c
  2. Download "stdAJC_dddd123.patch.zip" from here, extract "stdAJC_dddd123.patch" from the zip and place it inside the above AspectJ repository's top level.
  3. Apply the patch by executing:
    git apply --whitespace=nowarn stdAJC_dddd123.patch
  4. Build the AspectJ project using ant. You can execute the command
    ant
    at the top level of the AspectJ's repository.
  5. Deploy the AspectJ's libraries. If the previous step is successful, there will be a new folder called aj-build appearing at the top level of the repository. Add all the jar files in <path-to-aspectj-repository>/aj-build/dist/tools/lib to your AspectJ compiler's CLASSPATH.


After generating the new AspectJ libraries and deploying them, your AspectJ compiler should be able to handle the classes with huge methods now.

Personal tools
Namespaces

Variants
Actions
Navigation