Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Load Time Weaving in Eclipse

Hi again,
I have been several days thinking about how to make use o f LTW in Aspects. The problem is that it is the wtk the one who runs it, using the java command to launch the emulator (thus I cannot use the aj command there, since it would be useless). Aparently the Midlet is compiled a built into a jar and jad file, which are executed in the emulator.
I assume that the aj command should replace a java one. Please let me know if I am wrong because maybe I am focusing on a wrong direction.
 
Any suggestion or comment is appreciated,
Thanks a lot,
Guadalupe

2009/3/14 Andy Clement <andrew.clement@xxxxxxxxx>
Hi,

Glad you got it working.  The docs are a little weak in this area, but there are a few options for plugging a weaver in:

http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html

More info is likely to be found if searching the list archives for WeavingURLClassLoader.  If I need to change something in order to support your scenario, we can look to do that - but I know nothing about midlets I'm afraid.

cheers,
Andy.

2009/3/14 Guadalupe Ortiz <gobellot@xxxxxxxxx>

Hi Andy,
It works, I think the problem was I was using an aspect in a different package than main class. When nothing worked at all I changed that and I forgot to change it back. Anyway now it works, thanks to all the suggestions.
 
My question now is, is it possible to do it without the -javaagent? Midlets Java suite does not accept this option at all and I am looking for a way to do ltw or rtw in midlets project.
 
Thanks a lot for your help,
Guadalupe
2009/3/13 Andy Clement <andrew.clement@xxxxxxxxx>
it must be in a META-INF folder on the classpath, not just on the classpath in some random directory.  However, if you have used -outxml then the compiler should have put it in the right place in the jar you created when building the AspectJ project.  And that jar should be what is on the classpath - your AspectName.jar - are you sure you have the path to that exactly correct?


Andy.

2009/3/13 Guadalupe Ortiz <gobellot@xxxxxxxxx>
Yes, I had the classpath in the VM arguments section. I have deleted it and added it to classpath panel.
My feeling is that the project is not reaching the aop.xml file. Is there any configuration I have to do to the project to make it "be aware" of the aop.xml project?
Thanks a lot,
Guadalupe

2009/3/13 Andy Clement <andrew.clement@xxxxxxxxx>
Perhaps the clue I overlooked was here:


> I am trying to test Load TIme Weaving with the AJDT Eclipse plugin. (I could make it work out of Eclipse and I could make normal weaving in Eclipse)

If you can't make it work inside Eclipse then there must be a problem with the launch configuration.  When I define a launch configuration for loadtime weaving, I specify the javaagent setting in the VM arguments box, and then I setup the classpath on the classpath panel, I do not specify -classpath in the VM arguments section.  Where are you setting the classpath?


Andy.

2009/3/13 Guadalupe Ortiz <gobellot@xxxxxxxxx>
Dear Andy,
I used your documentation to test it initially (indeed it is very well explained).
 
I tried to add -verbose and -showWeaveInfo to the .xml (both in the aspect jar and the Java project web-inf). I also changed src classpath directions to bin.
Nothing changed and nothing extra showed in the console.
 
I am not using Load-time weaving application launch configuration (answering to Andrew) because my goal is to use this with Midlets and I think this option would not be compatible to them.
 
What else can I try?
 
Thanks  a lot for your comments. I am looking forward to new suggestions.

2009/3/13 Andy Clement <andrew.clement@xxxxxxxxx>

Hi,


-javaagent:C:\aspectj1.6\lib\
aspectjweaver.jar -classpath "PATHTOJAVAPROJECT\src;  PATHTOASPECTPROJECT\AspectName.jar; C:\aspectj1.6\lib\aspectjweaver.jar"
 
shouldn't that say 'PATHTOJAVAPROJECT\bin' rather than PATHTOJAVAPROJECT\src?

add an extra aop.xml file to your java project, put it in  META-INF\aop.xml and turn on debugging for the weaver.  The options for what to put in there to turn on debugging are discussed here:

http://andrewclement.blogspot.com/2009/02/load-time-weaving-basics.html

that will tell you whether it is a problem even creating the weaver, or with the aspects.

Andy


2009/3/13 Guadalupe Ortiz <gobellot@xxxxxxxxx>
Hi all,
I am trying to test Load TIme Weaving with the AJDT Eclipse plugin. (I could make it work out of Eclipse and I could make normal weaving in Eclipse)
What I have is
1) a Java Project with a Java application
2) an AspectJ Project which has an aspect which would intercept a method execution in the Java application.
3) An aop.xml file defining the available aspects in the AspectJ Project and in a WEB-INF directory in the Java project .
 
The aspect has been weaved with ajc AspectName.java -outxml -outjar aspectName.jar
In the Java Project VM arguments I have added -javaagent:C:\aspectj1.6\lib\aspectjweaver.jar -classpath "PATHTOJAVAPROJECT\src;  PATHTOASPECTPROJECT\AspectName.jar; C:\aspectj1.6\lib\aspectjweaver.jar"
 
The project runs properly but the aspect is not taken into account.
 
Any help is welcomed,
thanks a lot,
Guadalupe

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Dr. Guadalupe Ortiz Bellot
Assistant Professor
Computer Science Department
University of Extremadura

gobellot@xxxxxxx
http://personales.ya.com/gobellot/

Quercus Software Engineering Group
http://quercusseg.unex.es

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Dr. Guadalupe Ortiz Bellot
Assistant Professor
Computer Science Department
University of Extremadura

gobellot@xxxxxxx
http://personales.ya.com/gobellot/

Quercus Software Engineering Group
http://quercusseg.unex.es

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Dr. Guadalupe Ortiz Bellot
Assistant Professor
Computer Science Department
University of Extremadura

gobellot@xxxxxxx
http://personales.ya.com/gobellot/

Quercus Software Engineering Group
http://quercusseg.unex.es

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Dr. Guadalupe Ortiz Bellot
Assistant Professor
Computer Science Department
University of Extremadura

gobellot@xxxxxxx
http://personales.ya.com/gobellot/

Quercus Software Engineering Group
http://quercusseg.unex.es

Back to the top