-
1. Re: Online weaving Ant task
ad-rocha Oct 23, 2004 10:28 PM (in response to ad-rocha)Sorry... not aspectwerks.bat
I'm looking for a Ant task to make Loadtime instrumentation. Precompiled instrumentation is shown in:
http://docs.jboss.org/aop/aspect-framework/reference/en/html/compiling.html
But there is no information about Loadtime...
Thanks,
André -
2. Re: Online weaving Ant task
kabirkhan Oct 24, 2004 6:09 AM (in response to ad-rocha)Hi,
depending on which loadtime method you want to use
http://docs.jboss.org/aop/aspect-framework/reference/en/html/running.html
you basically just pass in a system property/jvm argument. The examples shown are for running off the command line, but you do exactly the same for the ant task. -
3. Re: Online weaving Ant task
ad-rocha Oct 24, 2004 4:48 PM (in response to ad-rocha)Hi,
I'm trying the reference guide example, and create a Ant project to do loadtime weaving (I don't want to precompile). It's not working... the result is "AOP!" (not "Hello, AOP!")
Any ideas?
Thanks,
André -
4. Re: Online weaving Ant task
kabirkhan Oct 24, 2004 4:56 PM (in response to ad-rocha)Post some more info
-
5. Re: Online weaving Ant task
ad-rocha Oct 24, 2004 5:29 PM (in response to ad-rocha)Class:
package teste;
public class HelloAOP {
public void callMe() {
System.out.println("AOP!");
}
public static void main(String args[]) {
new HelloAOP().callMe();
}
}
Aspect:
package teste;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
public class HelloAOPInterceptor implements Interceptor {
public String getName() {
return "HelloAOPInterceptor";
}
public Object invoke(Invocation invocation) throws Throwable {
System.out.print("Hello, ");
return invocation.invokeNext();
}
}
AOP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Ant: -
6. Re: Online weaving Ant task
ad-rocha Oct 24, 2004 5:35 PM (in response to ad-rocha)AOP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <aop> <bind pointcut="execution(public void HelloAOP->callMe())"> <interceptor class="HelloAOPInterceptor"/> </bind> </aop>
Ant:<project default="weave"> <target name="weave"> <property name="jboss.dir" value="D:/jboss-aop_1.0.0-FINAL"/> <property name="libs.dir" value="${jboss.dir}/lib"/> <path id="jboss.path"> <pathelement location="."/> <pathelement location="${libs.dir}/concurrent.jar"/> <pathelement location="${libs.dir}/javassist.jar"/> <pathelement location="${libs.dir}/jboss-aop.jar"/> <pathelement location="${libs.dir}/jboss-aspect-library.jar"/> <pathelement location="${libs.dir}/jboss-common.jar"/> <pathelement location="${libs.dir}/qdox.jar"/> <pathelement location="${libs.dir}/trove.jar"/> </path> <java classname="teste.HelloAOP" classpathref="jboss.path"> <arg line="-Djboss.aop.path=teste.xml"/> <arg line="-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader"/> </java> </target> </project>
-
7. Re: Online weaving Ant task
kabirkhan Oct 24, 2004 5:46 PM (in response to ad-rocha)Try:
<java classname="teste.HelloAOP" classpathref="jboss.path"> <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader"/> <sysproperty key="jboss.aop.path" value="teste.xml"/> </java>
If that doesn't work, try renaming the teste.xml to teste-aop.xml -
8. Re: Online weaving Ant task
ad-rocha Oct 24, 2004 5:52 PM (in response to ad-rocha)Thanks, but still not working...
-
9. Re: Online weaving Ant task
kabirkhan Oct 24, 2004 5:57 PM (in response to ad-rocha)Note the pakage names:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <aop> <bind pointcut="execution(public void teste.HelloAOP->callMe())"> <interceptor class="teste.HelloAOPInterceptor"/> </bind> </aop>
-
10. Re: Online weaving Ant task
ad-rocha Oct 24, 2004 6:18 PM (in response to ad-rocha)Still not working (again)...
Is there a verbose mode?
Is there a way to send to you the files?
Thanks,
André -
11. Re: Online weaving Ant task
kabirkhan Oct 25, 2004 6:35 AM (in response to ad-rocha)For verbose mode set the system property jboss.aop.verbose to true, i.e
You can send them to me at kabir.khan a jboss.org -
12. Re: Online weaving Ant task
kabirkhan Oct 25, 2004 7:59 AM (in response to ad-rocha)Got the files, and you need to set fork=true in the javac task:
<java classname="teste.HelloAOP" classpathref="jboss.path" fork="true"> <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader"/> <sysproperty key="jboss.aop.path" value="teste.xml"/> </java>
Otherwise, it executes as part of the java process executing ant, effetively ignoring the java.system.class.loader property, since that is only checked on the first call to java.lang.ClassLoader.getSystemClassLoader().
It works for me now, sorry I overlooked this :-) -
13. Re: Online weaving Ant task
ad-rocha Oct 25, 2004 8:37 AM (in response to ad-rocha)It's working now. Thank you!!!!
André -
14. Re: Online weaving Ant task
bill.burke Oct 25, 2004 8:56 AM (in response to ad-rocha)Andre, thanks for your patience!!!! If you have any further bug fixes or enhancement ideas, please don't hesitate to post on the forum!
Thanks again,
Bill