[jboss-user] [JBoss AOP] - Re: Compile Time AOP in JBOSS

gebhardtj do-not-reply at jboss.com
Tue Nov 20 07:43:35 EST 2012


gebhardtj [https://community.jboss.org/people/gebhardtj] created the discussion

"Re: Compile Time AOP in JBOSS"

To view the discussion, visit: https://community.jboss.org/message/777422#777422

--------------------------------------------------------------
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
[https://community.jboss.org/message/777422#777422]

Start a new discussion in JBoss AOP at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121120/bffde438/attachment.html 


More information about the jboss-user mailing list