I’d expect CTW to just work, providing the contents of aspectjrt.jar can successfully be accessed when packaged in whatever way you need to as an app dependency for JBoss.
Andrew described a possible plugin model for loader delegation, which I can see could help - but in AspectJ we have really tried to avoid that by deliberately not being at all clever when using class loaders (and in most cases this is fine). There is Equinox Aspects project that provides AspectJ support in OSGi but I don’t know if it is forced to use some tricks to work with the OSGi loading model. From my point of view the aspects should be visible in the same way as other dependencies of a deployed application. The difference is that we want the bytes for those things so we load them via getResourceAsStream() rather than forName(). Unfortunately that long explanation of JBoss loading is too much for me to get into right now. But, how, say are regular resources loaded by an application (non classes)? Do they need to be put somewhere else or need some other flag specifying, if they do then maybe that extra config needs to be done for the aspect classes (i.e. treat them more like resource dependencies than class dependencies). I don’t know anything about how it’ll work/break with JDK9 - if anyone wants to test it out, I’d love to hear about the findings. cheers, Andy > On Nov 11, 2014, at 7:23 AM, jlp <[email protected]> wrote: > > I made a mistake when i said that JBoss Kernel was an Osgi Kernel, it is a > custom micro-kernel that seems to Osgi but it is not Osgi like Glassfish, > JOnAS, Eclipse, Weblogic ... > The classloader mecanism of Jboss modules is explained here > <http://www.javacodegeeks.com/2012/09/jboss-as-7-classloading-explained.html> > > When an application is deployed on the deployementd directoty, there is an > implicit jboss module created. The classes of this implicit modules can be > woven with byteman with the parameter that delegates to the system > classloader JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,jlp,com.ibm" that > acts like org.osgi.framework.bootdelegation of OSGI Bundles. The JBoss > parameter runs correctly with Byteman but not correctly with aspectj ( a bcel > issue with AspectJ). > > For JBoss declared modules, it seems that the problem is not resolved also > with Byteman as related in this post of the Byteman developper ( Andrew yes > another Andrew :-) DINN) => > https://developer.jboss.org/thread/248812 > <https://developer.jboss.org/thread/248812> > > so i think that the problem is the same with declared JBOSS module. Andrew > DINN has some ideas with Byteman, do you ( Andy CLEMENT) have the same with > JBoss, Jigsaw ( JDK 9) , Osgi against AspectJ ? > > In a couple of monthes, i will be free to study this case ( Byteman and > AspectJ) . I have no tested AspectJ at CTW with JBoss. I will do it also. > > For information : > AspectJ vs Byteman > Roughly : > Common : Both can act at LoadTImeWeaving ( Byteman only as LTW) > > AspectJ <=> Byteman > Pointcut <=> Rule > Advice <=> Helper > > there are also a lot of differences ( no wild character with Byteman ...) > > > Le 10/11/2014 18:27, Andy Clement a écrit : >> Hi, >> >> AspectJ deliberately doesn’t try to do anything funky with class loaders as >> that is always painful. But if the environment it is running on is being too >> clever it can trip us up. To access the class file data we are making a >> call: >> >> InputStream is = loaderRef.getClassLoader().getResourceAsStream(classFile + >> ".class"); >> >> But in that environment it is not giving us an answer. Possibly getResource >> is being handled differently to loadClass? Can we find out more about the >> delegation strategy it is using for loading things? Any further JBoss config >> options we can tweak? >> >> I’m happy to work with someone on resolving this but I really don’t know a >> lot about JBoss. >> >> cheers, >> Andy >> >>> On Nov 10, 2014, at 12:38 AM, jean-louis.pasturel >>> <[email protected] <mailto:[email protected]>> >>> wrote: >>> >>> >>> A long time ago, i have this problem and i raised the bug below. It is >>> still open. The cause is the gestion of classloader with jboss modules. >>> I test at every version of aspectj, but the bug is still here. I have no >>> tested with aspectj 1.8.x. The workaround does not run also. >>> For injecting code on jboss serverr, i swtiched to byteman >>> http://byteman.jboss.org/ <http://byteman.jboss.org/> >>> >>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=406817 >>> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=406817> >>> >>> >>> >>> Envoyé depuis mon appareil mobile Samsung >>> >>> >>> >>> -------- Message d'origine -------- >>> De : 刘洋 <[email protected] <mailto:[email protected]>> >>> Date : 10/11/2014 9:03 (GMT+01:00) >>> A : [email protected] <mailto:[email protected]> >>> Objet : [aspectj-users] LTWJboss7 error >>> >>> >>> Does anyone know whether AspectJ with LTW works for JBoss 7? I tried >>> following these instructions but got errors below >>> >>> >>> 12:30:37,746 ERROR [stderr] [ModuleClassLoader@3243b595] info AspectJ >>> Weaver Version 1.6.12 built on Tuesday Oct 18, 2011 at 17:52:06 GMT >>> >>> 12:30:37,762 ERROR [stderr] [ModuleClassLoader@3243b595] info register >>> classloader org.jboss.modules.ModuleClassLoader@3243b595 >>> >>> >>> >>> 13:57:01,634 ERROR [stderr] [JasperLoader@64f221c7] info register >>> classloader org.apache.jasper.servlet.JasperLoader@64f221c7 >>> >>> >>> INSTRUCTIONS : http://wiki.eclipse.org/LTWJboss7 >>> <http://wiki.eclipse.org/LTWJboss7> >>> >>> Thanks, >>> ouxijv >>> 2014-11-10 >>> >>> >>> >>> >>> _______________________________________________ >>> aspectj-users mailing list >>> [email protected] <mailto:[email protected]> >>> To change your delivery options, retrieve your password, or unsubscribe >>> from this list, visit >>> https://dev.eclipse.org/mailman/listinfo/aspectj-users >>> <https://dev.eclipse.org/mailman/listinfo/aspectj-users> > > _______________________________________________ > 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
_______________________________________________ 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
