| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Chapter 5. Dumping classes during load-time weaving</title><link rel="stylesheet" href="aspectj-docs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.44"><link rel="home" href="index.html" title="The AspectJtm Problem Diagnosis Guide"><link rel="up" href="index.html" title="The AspectJtm Problem Diagnosis Guide"><link rel="previous" href="trace.html" title="Chapter 4. Tracing"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Dumping classes during load-time weaving</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="trace.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="ltwdump"></a>Chapter 5. Dumping classes during load-time weaving</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="ltwdump.html#ltwdump-introduction">Introduction</a></dt><dd><dl><dt><a href="ltwdump.html#ltw-examples">Configuring bytecode dumping in load-time weaving</a></dt><dt><a href="ltwdump.html#ltwdump-examples">LTW Dump Examples</a></dt></dl></dd></dl></div><div class="sect1"><a name="ltwdump-introduction"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ltwdump-introduction"></a>Introduction</h2></div></div><p> |
| Very rarely problems may be encountered with classes that have been |
| load-time woven. |
| Symptoms will include incorrect program function or a Java exception such as |
| <tt>java.lang.VerifyError</tt>. |
| In these situations it's most helpful to include the offending class |
| in the bug report. When using load-time weaving the woven classes are |
| in memory only so to save them to disk configure |
| <tt>META-INF/aop.xml</tt> to dump the classes (by default |
| to an <tt>_ajdump</tt> subdirectory of the current working |
| directory). Also if the input class file is not available |
| (e.g. it is a generated proxy or has already been instrumented by another agent) |
| you can configure the weaver to dump the input classes as well. |
| </p><div class="sect2"><a name="ltw-examples"></a><div class="titlepage"><div><h3 class="title"><a name="ltw-examples"></a>Configuring bytecode dumping in load-time weaving</h3></div></div><p> |
| For details of how to configure byte-code dumping, see the |
| AspectJ Development Environment Guide section on |
| <a href="../devguide/ltw-configuration.html#configuring-load-time-weaving-with-aopxml-files" target="_top"> |
| Configuring Load-time Weaving</a>. |
| Following is a simple example. |
| </p></div><div class="sect2"><a name="ltwdump-examples"></a><div class="titlepage"><div><h3 class="title"><a name="ltwdump-examples"></a>LTW Dump Examples</h3></div></div><p> The following <tt>META-INF/aop.xml</tt> will |
| weave classes in the <tt>com.foo</tt> package (and subpackages) but not |
| CGLIB generated classes in the <tt>com.foo.bar</tt> package (and subpackages). |
| It will also ensure all |
| woven byte-code is dumped both before and after weaving. </p><pre class="programlisting"> |
| <aspectj> |
| <aspects> |
| <aspect name="ataspectj.EmptyAspect"/> |
| </aspects> |
| <weaver options="-verbose -debug"> |
| <dump within="com.foo.bar..*" beforeandafter="true"/> |
| <include within="com.foo..*"/> |
| <exclude within="com.foo.bar..*CGLIB*"/> |
| </weaver> |
| </aspectj> |
| </pre><p> You should see messages similar to this: </p><pre class="programlisting"> |
| [WeavingURLClassLoader] info AspectJ Weaver Version 1.5.3 built on Thursday Oct 26, 2006 at 17:22:31 GMT |
| [WeavingURLClassLoader] info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader |
| [WeavingURLClassLoader] info using configuration /C:/tempMETA-INF/aop.xml |
| [WeavingURLClassLoader] info register aspect ataspectj.EmptyAspect |
| [WeavingURLClassLoader] debug not weaving 'com.foo.bar.Test$$EnhancerByCGLIB$$12345' |
| [WeavingURLClassLoader] debug weaving 'com.foo.bar.Test' |
| </pre><p> On disk you would find the following files: </p><pre class="programlisting"> |
| _ajdump/_before/com/foo/bar/Test.class |
| _ajdump/com/foo/bar/Test.class |
| </pre></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="trace.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left">Chapter 4. Tracing </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> </td></tr></table></div></body></html> |