<div dir="ltr">So one possibility that comes to mind would be to create a small deployment that does the aspectJ attach on deploy (e.g. in a @PostConstruct method of an @Startup EJB). <div><br></div><div>You could then add an inter-deployment dependency on this deployment to all your other deployments, which should ensure that this code is run before other modules are created/loaded.</div><div><br></div><div>Stuart</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 18, 2017 at 4:00 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">Hi,<div><br></div><div>I'm looking to use AspectJ Load Time Weaving with Wildfly 10. Looking around at some posts, it is a little complicated to get Wildfly launched properly with the AJ weaver due to the way the AJ library intializes the logging subsystem differently than WF.</div><div><br></div><div>Digging around, I found a config that actually works. It is documented here (obviously some of the class names/versions have to change): <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></div><div><br></div><div>But I'm not a fan of changing my conf file to something that has hardcoded paths/jar names in it - for example adding:</div><div><span style="background-color:rgb(255,255,255)"> </span><span style="background-color:rgba(27,31,35,0.05);color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.6px">-Xbootclasspath/p:$JBOSS_<wbr>HOME/modules/system/layers/<wbr>base/org/jboss/logmanager/<wbr>main/jboss-logmanager-2.0.0.<wbr>Final.jar </span></div><div><span style="background-color:rgba(27,31,35,0.05);color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.6px"><br></span></div><div><span style="background-color:rgba(27,31,35,0.05);color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.6px"><br></span></div>Digging around some more in AJ, I saw that as of AJ 1.8.7, there is a way to dynamically attach the weaver to the JVM. Very cool. <a href="https://www.eclipse.org/aspectj/doc/released/README-187.html" target="_blank">https://www.eclipse.<wbr>org/aspectj/doc/released/<wbr>README-187.html</a> <div>But in order to use the LTW effectively, I need to ensure that the weaver is loaded prior to WF scanning and loading any of my classes (EJB, annotated beans, pojos, etc). But I have no ideas how to do that.</div><div><br></div><div>In the case of a console application, it is pretty straight forward - make it the first item in the application's main() method. But in the case of a JEE app, I don't know of any main() equivalent.</div><div><br></div><div><br></div><div>Is there a way to hook into the classloading mechanism of WF instead to tell it to load the weaver if it isn't already loaded? Can this be done from within the EAR deployment? Or is there a single point of entry that WF accesses before scanning any of the classes in the EAR? Or is there a simpler way of configuring or attaching the AJ Weaver? I did find an old ticket (<a href="https://issues.jboss.org/browse/WFLY-895" target="_blank">https://issues.jboss.org/<wbr>browse/WFLY-895</a>) that related to this issue, but it is marked as WONT FIX.</div><div><br></div><div>Am not sure of the best approach at this point.</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Eric</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>