So this is probably more of a Wildfly question than an AspectJ question as
such, and I have already asked the Wildfly team about it, but I thought I
would try to get additional clarity from the AJ pros to understand exactly
how the LTW agent works.

My use case is that I want to use use AspectJ to advise some core classes
in Wildfly/undertow.  Specifically, I'm trying to advise some of the
Undertow HttpSession methods to get some more detailed logging when
Sessions are created/expire/etc.

To that extent, I've added AspectJ as a -javaagent which is launched on
startup of Wildfly.  I had to follow some of the steps listed at:
https://github.com/ChienChingLee/How-to-launch-Wildfly-9.0-with-AspectJ-1.8-LTW.
But it works; I can see that the AJ weaver is loaded and present.

My problem now has to do with the way that the Wildfly classloaders work.
>From my understanding, to avoid class conflict issues, the Application
Server is designed such that everything is broken down into individual
modules, with a separate classloader for each module.  Modules can declare
dependencies on other modules if they truly want/need to access classes
defined in a different module (see
https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly)

I've tried to configure AJ to have the loader available to all modules, so
now my question is how does AJ detect Aspects in the classpath?  Where/how
does it search for the aop.xml file?  Does the weaver search every jar that
is in the classpath for these files?  How does it determine which files to
scan in the classpath?  Does it simply delegate that to the classloader?
(ie: Class.getResourceAsStream("aop.xml"))?  I haven't dug through the AJ
code to see exactly what it does.

Right now, I'm a little stuck in that I'm not sure how to ensure that my
Aspects are loaded with every module in WF.  I've managed to reconfigure a
single module and it works, but the idea of reconfiguring every module
individually doesn't make sense.

I tried to create an independent module in WF for it, and declaring it as a
global module but that didn't seem to work.

I tried to add it to the startup parameters in the WF startup configuration
file, specifying it as -classpath path/to/myaspect.jar, but that only
advised the startup WF (org.jboss) classes and none of the modules.

Can anyone shed some more light how the LTW works in order to search/find
and weave classes?  Or if anyone has any brilliant ideas how I can
configure my WF server such that I can drop my asepcts.jar in a "generic"
place to make it woven into every module, I would appreciate it.

Thanks!

Eric
_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to