You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ltwdump.xml 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <chapter id="ltwdump" xreflabel="Dumping classes during load-time weaving">
  2. <title>Dumping classes during load-time weaving</title>
  3. <sect1 id="ltwdump-introduction">
  4. <title>Introduction</title>
  5. <para>
  6. Very rarely problems may be encountered with classes that have been
  7. load-time woven.
  8. Symptoms will include incorrect program function or a Java exception such as
  9. <literal>java.lang.VerifyError</literal>.
  10. In these situations it's most helpful to include the offending class
  11. in the bug report. When using load-time weaving the woven classes are
  12. in memory only so to save them to disk configure
  13. <literal>META-INF/aop.xml</literal> to dump the classes (by default
  14. to an <literal>_ajdump</literal> subdirectory of the current working
  15. directory). Also if the input class file is not available
  16. (e.g. it is a generated proxy or has already been instrumented by another agent)
  17. you can configure the weaver to dump the input classes as well.
  18. </para>
  19. <sect2 id="ltw-examples" xreflabel="ltwdump-configuration">
  20. <title>Configuring bytecode dumping in load-time weaving</title>
  21. <para>
  22. For details of how to configure byte-code dumping, see the
  23. AspectJ Development Environment Guide section on
  24. <ulink url="../devguide/ltw-configuration.html#configuring-load-time-weaving-with-aopxml-files">
  25. Configuring Load-time Weaving</ulink>.
  26. Following is a simple example.
  27. </para>
  28. </sect2>
  29. <sect2 id="ltwdump-examples" xreflabel="LTW Dump Examples">
  30. <title>LTW Dump Examples</title>
  31. <para> The following <literal>META-INF/aop.xml</literal> will
  32. weave classes in the <literal>com.foo</literal> package (and subpackages) but not
  33. CGLIB generated classes in the <literal>com.foo.bar</literal> package (and subpackages).
  34. It will also ensure all
  35. woven byte-code is dumped both before and after weaving. </para>
  36. <programlisting><![CDATA[
  37. <aspectj>
  38. <aspects>
  39. <aspect name="ataspectj.EmptyAspect"/>
  40. </aspects>
  41. <weaver options="-verbose -debug">
  42. <dump within="com.foo.bar..*" beforeandafter="true"/>
  43. <include within="com.foo..*"/>
  44. <exclude within="com.foo.bar..*CGLIB*"/>
  45. </weaver>
  46. </aspectj>
  47. ]]></programlisting>
  48. <para> You should see messages similar to this: </para>
  49. <programlisting><![CDATA[
  50. [WeavingURLClassLoader] info AspectJ Weaver Version 1.5.3 built on Thursday Oct 26, 2006 at 17:22:31 GMT
  51. [WeavingURLClassLoader] info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader
  52. [WeavingURLClassLoader] info using configuration /C:/tempMETA-INF/aop.xml
  53. [WeavingURLClassLoader] info register aspect ataspectj.EmptyAspect
  54. [WeavingURLClassLoader] debug not weaving 'com.foo.bar.Test$$EnhancerByCGLIB$$12345'
  55. [WeavingURLClassLoader] debug weaving 'com.foo.bar.Test'
  56. ]]></programlisting>
  57. <para> On disk you would find the following files: </para>
  58. <programlisting><![CDATA[
  59. _ajdump/_before/com/foo/bar/Test.class
  60. _ajdump/com/foo/bar/Test.class
  61. ]]></programlisting>
  62. </sect2>
  63. </sect1>
  64. </chapter>