aboutsummaryrefslogtreecommitdiffstats
path: root/docs/pdGuideDB/ltwdump.xml
blob: 72554d0432b80d5026ca4a0272e7645827730ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<chapter id="ltwdump" xreflabel="Dumping classes during load-time weaving">
    <title>Dumping classes during load-time weaving</title>

    <sect1 id="ltwdump-introduction">
        <title>Introduction</title>

        <para>
        	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
        	<literal>java.lang.VerifyError</literal>.
            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
            <literal>META-INF/aop.xml</literal> to dump the classes (by default
            to an <literal>_ajdump</literal> 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.
        </para>
        <sect2 id="ltw-examples" xreflabel="ltwdump-configuration">
            <title>Configuring bytecode dumping in load-time weaving</title>
            <para>
  			For details of how to configure byte-code dumping, see the
            AspectJ Development Environment Guide section on
				<ulink url="../devguide/ltw-configuration.html#configuring-load-time-weaving-with-aopxml-files">
				Configuring Load-time Weaving</ulink>.
            Following is a simple example.
            </para>
            </sect2>

        <sect2 id="ltwdump-examples" xreflabel="LTW Dump Examples">
            <title>LTW Dump Examples</title>

            <para> The following <literal>META-INF/aop.xml</literal> will
            weave classes in the <literal>com.foo</literal> package (and subpackages) but not
            CGLIB generated classes in the <literal>com.foo.bar</literal> package (and subpackages).
            It will also ensure all
            woven byte-code is dumped both before and after weaving. </para>
	        <programlisting><![CDATA[
<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>
]]></programlisting>

            <para> You should see messages similar to this: </para>

	        <programlisting><![CDATA[
[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'
]]></programlisting>

            <para> On disk you would find the following files: </para>

	        <programlisting><![CDATA[
_ajdump/_before/com/foo/bar/Test.class
_ajdump/com/foo/bar/Test.class
]]></programlisting>

        </sect2>
    </sect1>
</chapter>