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&...]