<div dir="ltr">I've been trying that, but something is still not working right. The individual module classloaders are not seeing the class as defined by my startup string.<div><br>I'm staring WF using the following arguments:</div><div><div><br></div><div>-Djboss.modules.system.pkgs=<wbr>org.jboss.byteman,org.aspectj,<wbr>test.aspectj,org.jboss.<wbr>logmanager</div><div>-javaagent:c:/dev/tmp/jboss-<wbr>eap-7.0.0/modules/system/<wbr>layers/base/org/aspectj/main/<wbr>aspectjweaver-1.8.10.jar</div><div>-Dorg.aspectj.weaver.<wbr>showWeaveInfo=true"</div><div>-Dorg.aspectj.weaver.loadtime.<wbr>configuration=file:c:/tmp/poc/<wbr>aop.xml</div><div><div>-cp C:/dev/Projects/jms/mixed-<wbr>arch/ear-app/aspectj/target/<wbr>aspectj-0.0.1-SNAPSHOT.jar</div></div><div><br></div><div>But I get the following errors thrown my the AspectJ Weaver: </div><div><br></div><div>2017-10-26 12:11:39,889 ERROR [stderr] (MSC service thread 1-7) [ModuleClassLoader@336f62a1] info register aspect test.aspectj.TestAspect</div><div>2017-10-26 12:11:54,632 ERROR [stderr] (MSC service thread 1-7) [ModuleClassLoader@336f62a1] error The specified aspect 'test.aspectj.TestAspect' cannot be found</div></div><div><br></div><div><div>I've confirmed that my class (test.aspectj.TestAspect) is indeed in the aspectj-0.0.1-SNAPSHOT.jar.</div><div><br></div><div>So I get the impression that the aspectj-SNAPSHOT jar is not being made visible to the individual module classloaders. I've tried to debug the weaver, and can see that it does indeed do the following:</div></div><div><div><br></div><div><span style="white-space:pre-wrap">        </span>private URL toURL(String className) {</div><div><span style="white-space:pre-wrap">                </span>URL url = (URL) nameMap.get(className);</div><div><span style="white-space:pre-wrap">                </span>if (url == null) {</div><div><span style="white-space:pre-wrap">                        </span>String classFile = className.replace('.', '/');</div><div><span style="white-space:pre-wrap">                        </span>url = loaderRef.getClassLoader().<wbr>getResource(classFile + ".class");</div><div><span style="white-space:pre-wrap">                        </span>nameMap.put(className, url);</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span>return url;</div><div><span style="white-space:pre-wrap">        </span>}</div></div><div><br></div><div>where the loaderRef.getClassLoader() looks like it is the classloader that is passed to the ClassFileTransformer.<wbr>transform() method (<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/instrument/ClassFileTransformer.html" target="_blank">https://docs.oracle.com/<wbr>javase/7/docs/api/java/lang/<wbr>instrument/<wbr>ClassFileTransformer.html</a>).</div><div><br></div><div><br></div><div>I'm not sure where/how to go from here. Am I not passing the arguments correctly? is the -cp not included in the classloader that is used by the -javaagent/Instrumention? Where is the -Djboss.modules.system.pkgs used?</div><div><br></div><div>Thanks,</div><div><br>Eric</div><div><br></div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 2:31 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@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">Basically if the package name matches it just delegates to the system class loader, so if it is on the classpath or boot classpath it should be found.<span class="m_-2316289326204393182HOEnZb"><font color="#888888"><div><br></div><div>Stuart</div></font></span></div><div class="m_-2316289326204393182HOEnZb"><div class="m_-2316289326204393182h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 8:59 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="auto">Where does WF know where to find the corresponding jar that contains that package name? Does it take it from the jvm startup classpath parameters? Does it matter if it's -cp or -Xbootclasspath/a? <div dir="auto"><br></div><div dir="auto">Thanks</div><span class="m_-2316289326204393182m_-7138742599208098251HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Eric</div></font></span></div><div class="m_-2316289326204393182m_-7138742599208098251HOEnZb"><div class="m_-2316289326204393182m_-7138742599208098251h5"><div class="gmail_extra"><br><div class="gmail_quote">On Oct 23, 2017 3:07 PM, "Stuart Douglas" <<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 2:04 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"><div>Thanks for the tips, but i'm still struggling with this. Here's what I've done so far.</div><div><br></div><div>I've added the module name under -Djboss.modules.system.pkgs and added it as a cp argument as :</div></div></blockquote><div><br></div><div>This is not a module name, but a package name. You should not be creating a aspectj modules.</div><div><br></div><div>Stuart</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div> -Djboss.modules.system.pkgs=<wbr>org.jboss.byteman,org.aspectj,<wbr>org.jboss.logmanager</div><div> -classpath "D:\jboss-eap-7.0\modules\syst<wbr>em\layers\base\org\aspectj\mai<wbr>n\aspectj-0.0.1-SNAPSHOT.jar" <br></div><div><br></div><div>My org.aspectj module is defined as:</div><div><div><br></div><div><module xmlns="urn:jboss:module:1.3" name="org.aspectj"></div><div> <resources></div><div> <resource-root path="aspectjweaver-1.8.10.jar<wbr>"/></div><div> <resource-root path="aspectj-0.0.1-SNAPSHOT.j<wbr>ar"/></div><div> </resources></div><div></module></div></div><div><br></div><div><br></div><div><br></div><div>Now when I start Wildfly, I still don't see it trying to weave any of the base Wildfly/undertow modules. If I define the org.aspectj as a global module in the standalone.xml, the I see the weaver attempting to weave my application deployment but none of the base WF classes.</div><div><br></div><div>Does the jboss.modules.system.pkgs argument relate to the module name or to the package naming of the libraries? ie: do my aspects in aspectj-0.0.1-SNAPSHOT.jar also have to be in an 'org.aspectj' java package or am I free to use any package naming structure I want as long as they are part of the org.aspectj WF module definition? My aspect is actually in a test package called "aspectj". I even tried added "aspectj" to the jboss.modules.system.pkgs variable, but to no avail.</div><div><br></div><div>How does WF know where to find classes/packages defined in 'jboss.modules.system.pkgs'? </div><div><br></div><div>Thanks,</div><div><br>Eric</div><div><div class="m_-2316289326204393182m_-7138742599208098251m_5401300794950563387m_-166815338747811853h5"><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 22, 2017 at 7:09 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think you probably want to modify the classpath and also add -Djboss.modules.system.pkg<wbr>s=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"><div><div class="m_-2316289326204393182m_-7138742599208098251m_5401300794950563387m_-166815338747811853m_7265970116642630524gmail-h5">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></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_-2316289326204393182m_-7138742599208098251m_5401300794950563387m_-166815338747811853m_7265970116642630524gmail-h5"><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/ChienCh<wbr>ingLee/How-to-launch-Wildfly-9<wbr>.0-with-AspectJ-1.8-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.HttpSession<wbr>.invalidate(). In AJ language, the pointcut is simple: execution(* javax.servlet.http.HttpSession<wbr>+.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></div></div>______________________________<wbr>_________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">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/mailma<wbr>n/listinfo/wildfly-dev</a><br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>
</blockquote></div></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>