Class Loading and AOP

Note: this post is cross-posted on Cubeia.com.

I have a new article up, Debugging Class Loading with AOP, in which I briefly discuss how Aspect Oriented Programming (AOP) using AspectJ can be used to debug class loading, in particular in instances where a system have multiple class loaders.It does not cover how to use the load time weaver that comes with AspectJ. For you reference, this is roughly how to use it (for Java 5 or higher):

  1. Download AspectJ from the Eclipse site.
  2. Create a configuration file called “aop.xml” in a META-INF folder on the class path. For an example file, see below.
  3. Start your VM with: -javaagent:pathto/aspectjweaver.jar

Which is about it, the “aop.xml” file may look something like this for running the code in the article in a Tomcat 6 installation:

<code lost in blog system move>

Notice above that we include the base package of your application for weaving and the Catalina class loader packages. We’re doing this to limit the scope of the weaver, otherwise your debugging may take a bit too much time and resources.

Brain Scan

My brain’s hurting. I must be getting old.For reference, this is some of the programming topics I’ve read up on (or at least tried) lately:

  • Guice and Spring
  • Declarative transactions and JTA
  • EDA, Pipelines and CEP
  • SOA and ESB and NMR
  • Column databases and distributed file systems
  • Wicket and various related Ajax components
  • OSGi in various permutations with the above
  • BI, in-memory BI and CEP (again)
  • AOP and/or IoC patterns

And now I’m contemplating the fultility of programming.