> 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?

This is very likely the cause.  Typically AspectJ will look for the aop.xml
via a getResources("META-INF/aop.xml") call on the classloader. If the
classloader doesn't implement getResources in a good way, the file won't be
found. As an alternative (as I look at the AJ source code) you might be
able to specify a file path for it:

-Dorg.aspectj.weaver.loadtime.configuration=file:/path/to/my/aop.xml

cheers,
Andy


On 22 July 2013 03:21, Tugdual JULLIEN <tugdual.jull...@iiter.fr> wrote:

> Hello,****
>
> ** **
>
> I tried to do a simple project (hello world) with a simple aspect. I use
> Maven to build this project, LTW for the aspect, logback for the logs.****
>
> The aspect is weaved when I use:****
>
> "C:\Program Files\Java\jdk1.6.0_22\bin\java"
> -javaagent:.\libs\aspectjweaver-1.7.3.jar -cp
> ".\libs\ProtoApp-v0.0.1-SNAPSHOT.jar;.\libs\*" -Xms64m -Xmx512m
> -XX:MaxPermSize=128m -Daj.weaving.verbose=true
> -Dorg.aspectj.weaver.showWeaveInfo=true
> -Dlogback.configurationFile=file:.\logback.xml
> org.iiter.continuum.protos.simple.App****
>
> ** **
>
> But when I add parameters for JMX, the aspect is not weaved anymore:****
>
> "C:\Program Files\Java\jdk1.6.0_22\bin\java"
> -javaagent:.\libs\aspectjweaver-1.7.3.jar -cp
> ".\libs\ProtoApp-v0.0.1-SNAPSHOT.jar;.\libs\*" -Xms64m -Xmx512m
> -XX:MaxPermSize=128m -Daj.weaving.verbose=true
> -Dorg.aspectj.weaver.showWeaveInfo=true -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.continuum.protos.simple.App****
>
> ** **
>
> I can’t figure what’s happening, if any of you could help me.****
>
> ** **
>
> The options for JMX remote I added are:****
>
> -Dcom.sun.management.jmxremote****
>
> -Dcom.sun.management.jmxremote.port=7777****
>
> -Dcom.sun.management.jmxremote.authenticate=false****
>
> -Dcom.sun.management.jmxremote.ssl=false****
>
> ** **
>
> Tugdual****
>
> ** **
>
> PS: I tried for an OSGI app (equinox) and it works fine with this
> parameters for JMX, but I really need for a regular Java application.****
>
> ** **
>
> PPS : I posted my question in stackoverflow:
> http://stackoverflow.com/questions/17784939/aspectj-ltw-not-working-with-jmx-remote
> ****
>
> ** **
>
> *De :* aspectj-users-boun...@eclipse.org [mailto:
> aspectj-users-boun...@eclipse.org] *De la part de* Tugdual JULLIEN
> *Envoyé :* lundi 15 juillet 2013 15:49
> *À :* aspectj-users@eclipse.org
> *Objet :* [aspectj-users] AspectJ LTW problem with JMX****
>
> ** **
>
> 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!/META-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
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to