JBoss Community

Re: Compile Time AOP in JBOSS

created by gebhardtj in JBoss AOP - View the full discussion

Thanks for your quick responses.

 

I'm using JBoss 4.2.3 and jboss-aop 1.5.6. Unfortunately I cannot upgrade the AOP version to >= 2.0.0 :(

 

I decompiled the AspectManager and the instance() method looks like this:

 

public static synchronized AspectManager instance()

{

  return instance(Thread.currentThread().getContextClassLoader());

}

 

As I do not have any influence on my runtime environment I can only patch the ClassicInstrumentor at compile time and replace the following line

addStaticField(clazz, "aop$classAdvisor$aop", HELPER_CLASS_NAME, CtField.Initializer.byExpr(ASPECT_MANAGER_CLASS_NAME + ".instance().getAdvisor(java.lang.Class#forName(\"" + clazz.getName() + "\"))"));

by something else e.g.

addStaticField(clazz, "aop$classAdvisor$aop", HELPER_CLASS_NAME, CtField.Initializer.byExpr(ASPECT_MANAGER_CLASS_NAME + ".instance(java.lang.Class#forName(\"" + clazz.getName() + "\"))".getClassLoader()).getAdvisor(java.lang.Class#forName(\"" + clazz.getName() + "\"))"));

 

Maybe the classloader of the advised class is the correct one.

Reply to this message by going to Community

Start a new discussion in JBoss AOP at Community