Hello everybody,
When I start my application (console) with the weaver agent, without JMX, everything is fine, with JMX the aspect configuration is not found. I use Aspectj 1.7.3 (I tried version 1.7.0 and 1.7.1). The aspect configuration is done by the file META-INF/aop.xml which contains the weaver options: -Xlint:ignore -Xset:weaveJavaPackages=false,weaveJavaxPackages=false I searched and tried several solutions: - The aop.xml is not in the right place: moving the aop.xml in the sources in META-INF, generating with -outxml - The aspect configuration name: renaming aop.xml to aop-ajc.xml - There is classloader problems: I added the option -Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader - AspectJ can't find the jar with aspect: I added the options "-Daj.class.path=.\libs\*" "-Daj.aspect.path=.\libs\org.iiter.aspects.monitoring-0.0.1-SNAPSHOT.jar" The problem is still here. It seems that the classloader are different: sun.misc.Launcher$AppClassLoader without JMX, javax.management.remote.rmi.NoCallStackClassLoader with JMX. Could it be the cause? My projects are built with Maven. For the aspect, I use this plugin: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>${aspectj.plugin.version}</version> <configuration> <complianceLevel>${maven.compiler.source}</complianceLevel> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <dependencies> <!-- Ensure aspectj tools version used by compiler is the same version used as dependency. Avoids warning --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>${aspectj.rt.version}</version> </dependency> </dependencies> </plugin> All my jars (aspect, application and frameworks like slf4j and Spring) are in a "libs" directory. When I start my application without JMX: java -javaagent:.\libs\aspectjweaver-1.7.3.jar -cp ".\libs\application.jar;.\libs\*" -Xms64m -Xmx512m -XX:MaxPermSize=128m -Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader -Daj.weaving.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true "-Daj.class.path=.\libs\*" "-Daj.aspect.path=.\libs\org.iiter.aspects.monitoring-0.0.1-SNAPSHOT.jar" -Dlogback.configurationFile=file:.\logback.xml org.iiter.application.Launcher I get this logs: [AppClassLoader@64601bb1] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT [AppClassLoader@64601bb1] info register classloader sun.misc.Launcher$AppClassLoader@64601bb1 [AppClassLoader@64601bb1] info using configuration file:/C:/ compiled/application/libs/org.iiter.aspects.monitoring-0.0.1-SNAPSHOT.jar!/M ETA-INF/aop.xml [AppClassLoader@64601bb1] info register aspect org.iiter.aspects.monitoring.ContainerMonitoring [AppClassLoader@64601bb1] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified [AppClassLoader@64601bb1] weaveinfo Join point 'method-execution(void org.iiter.application.ContainerManager.start())' in Type 'org.iiter.application.ContainerManager' (ContainerManager.java:78) advised by before advice from 'org.iiter.aspects.monitoring.ContainerMonitoring' (ContainerMonitoring.aj:23) [AppClassLoader@64601bb1] weaveinfo Join point 'method-execution(void org.iiter.continuum.cdc.commons.ContainerManager.start())' in Type 'org.iiter.continuum.cdc.commons.ContainerManager' (ContainerManager.java:78) advised by after advice from 'org.iiter.aspects.monitoring.ContainerMonitoring' (ContainerMonitoring.aj:28) [AppClassLoader@64601bb1] weaveinfo Join point 'method-execution(void org.iiter.continuum.cdc.commons.ContainerManager.stop())' in Type 'org.iiter.continuum.cdc.commons.ContainerManager' (ContainerManager.java:109) advised by before advice from 'org.iiter.aspects.monitoring.ContainerMonitoring' (ContainerMonitoring.aj:33) [AppClassLoader@64601bb1] info processing reweavable type org.iiter.aspects.monitoring.ContainerMonitoring: org\iiter\ aspects\monitoring\ContainerMonitoring.aj [ExtClassLoader@61ba34f2] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT [ExtClassLoader@61ba34f2] info register classloader sun.misc.Launcher$ExtClassLoader@61ba34f2 [ExtClassLoader@61ba34f2] info no configuration found. Disabling weaver for class loader sun.misc.Launcher$ExtClassLoader@61ba34f2 When I start my application with JMX: java -javaagent:.\libs\aspectjweaver-1.7.3.jar -cp ".\libs\application.jar;.\libs\*" -Xms64m -Xmx512m -XX:MaxPermSize=128m -Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader -Daj.weaving.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true "-Daj.class.path=.\libs\*" "-Daj.aspect.path=.\libs\org.iiter.aspects.monitoring-0.0.1-SNAPSHOT.jar" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7777 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlogback.configurationFile=file:.\logback.xml org.iiter.application.Launcher I get this logs: [NoCallStackClassLoader@97d01f] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT [NoCallStackClassLoader@97d01f] info register classloader javax.management.remote.rmi.NoCallStackClassLoader@97d01f [NoCallStackClassLoader@97d01f] info no configuration found. Disabling weaver for class loader javax.management.remote.rmi.NoCallStackClassLoader@97d01f [NoCallStackClassLoader@7471dc3d] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT [NoCallStackClassLoader@7471dc3d] info register classloader javax.management.remote.rmi.NoCallStackClassLoader@7471dc3d [NoCallStackClassLoader@7471dc3d] info no configuration found. Disabling weaver for class loader javax.management.remote.rmi.NoCallStackClassLoader@7471dc3d [ExtClassLoader@61ba34f2] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT [ExtClassLoader@61ba34f2] info register classloader sun.misc.Launcher$ExtClassLoader@61ba34f2 [ExtClassLoader@61ba34f2] info no configuration found. Disabling weaver for class loader sun.misc.Launcher$ExtClassLoader@61ba34f2
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users