<div dir="ltr">I think you probably want to modify the classpath and also add -Djboss.modules.system.pkgs=org.aspectj (or whatever package aspectj classes are under). This system property is a comma separated list of non-modular packages that JBoss modules will just pass straight through to the system class loader.<div><br></div><div>Stuart</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 21, 2017 at 1:29 AM, Eric B <span dir="ltr"><<a href="mailto:ebenzacar@gmail.com" target="_blank">ebenzacar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to 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.<div><br></div><div>I've added AspectJ as a -javaagent which is launched on startup of Wildfly. I had to follow some of the steps listed at: <a href="https://github.com/ChienChingLee/How-to-launch-Wildfly-9.0-with-AspectJ-1.8-LTW" target="_blank">https://github.com/<wbr>ChienChingLee/How-to-launch-<wbr>Wildfly-9.0-with-AspectJ-1.8-<wbr>LTW</a>. But it works; I can see that the AJ weaver is loaded and present.</div><div><br></div><div>My problem now is that I don't know where to put my jar of aspects for it to be loaded/visible by the weaver for all modules. I've managed to get it to work by modifying the io.undertow.servlet module, adding my jar in the folder and modifying the module.xml, but that only advises the io.undertow.servlet.* classes. And it seems like quite an ugly hack to get to that.</div><div><br></div><div>I tried creating an independent module for it, and declaring it as a global module in my standalone.xml, but that didn't seem to work. Nor did modifying the servlet module.xml and specifying my module as a dependency.</div><div><br></div><div>I tried to add it to the startup parameters in the standalone.conf file, specifying it as -classpath path/to/myaspect.jar, but that only advised the startup WF (org.jboss) classes and none of the modules.</div><div><br></div><div>At the moment, I'm looking to advise any implementation of javax.servlet.http.<wbr>HttpSession.invalidate(). In AJ language, the pointcut is simple: execution(* javax.servlet.http.<wbr>HttpSession+.invalidate(..)) will match any implementation of the HttpSession interface. However, to make it active, I need to get that Aspect in the classpath of every module loaded and visible to the AJ weaver.<br></div><div><br></div><div><div>Is there a "generic" place I can declare the the aspects.jar so that it is part of the classpath of every module loaded or is my only choice to modify every module.xml in the system?</div><div><br></div><div>Thanks,</div></div><div><br>Eric</div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/wildfly-dev</a><br></blockquote></div><br></div>