Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsweaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659504/#msg_659504
I'm trying to print signatures of all methods called in an application (basically the whole call tree under "main" for a single thread java application).
Now the issue is, I can't get the java.* and javax.* classes weaved.
I have read pretty much everything on the web, including using the flags "-Xset:weaveJavaPackages=true,weaveJavaxPackages=true" in my weaver options, but I just can't get this to work.
Let me give some information:
- I use load-time-weaving.
- In my aop.xml, I describe the weaver with:
<weaver options="-Xset:weaveJavaPackages=true,weaveJavaxPackages=true -verbose -debug -showWeaveInfo">
<include within="javax.*"/>
<include within="java.*"/>
<include within="*"/>
</weaver>
(yep, I shouldn't need the java and javax ones since I use *, but I'm desperate at this point ).
- My aspect uses around, with this pointcut:
execution(* *(..)) && !within(MethodTracer)
I can see that my own classes are weaved and my own methods are traced, but not the javax and java ones.
I am doing the simplest thing to test this: use "System.out.println()" to see that it gets executed and my aspect is woven on it. But unfortunately this is not the case for me.
I'm sure this has come up many times before (as I said, I have read anything I could find on google), but I'm just stuck. Maybe another pair of eyes could help me..]]>Celal2011-03-14T11:06:38-00:00Re: weaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659506/#msg_659506
- I use aspectj (both rt and weaver) version 1.6.11.M2 (just to make sure I have the latest and greatest build)
- I created a javax.test package with a Test class and called a method in there, and it is picked up by the aspect correctly, with the appropriate logs:
"[AppClassLoader@fabe9] debug weaving 'javax.test.Test'
- I looked at the source code of aspectjweaver, and the options "-Xset:weaveJavaPackages=true,weaveJavaxPackages=true" are there, i.e. the code to parse them are inside the code.
(and I'm given the nice warning message if I don't put them):
[AppClassLoader@fabe9] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
[AppClassLoader@fabe9] debug cannot weave 'javax.test.Test'
So basically, it is only those classes in rt.jar that are not picked up I believe.
Thanks everyone in advance.]]>Celal2011-03-14T11:15:47-00:00Re: weaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659581/#msg_659581
The first workaround is a pain. You can try compile time weaving for the JDK. But this of course means that you need to use a specially modified JDK when running your app.
Alternatively (and this is probably something you don't want to hear either), just don't do it. Rather than using execution pointcuts, you can use call pointcuts and you won't require weaving into the JDK.
I wish there were a better answer for you, but load time weaving of the JDK is not what AspectJ was designed to do.]]>Andrew Eisenberg2011-03-14T16:31:39-00:00Re: weaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659624/#msg_659624
So, is there any other way that you can think of for me to get the call graph, including those methods called in the jdk? I guess I may have to go back to using one of those profilers.]]>Celal2011-03-14T20:25:53-00:00Re: weaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659636/#msg_659636
Andrew Eisenberg2011-03-14T21:16:06-00:00Re: weaving java and javax classes
https://www.eclipse.org/forums/index.php/mv/msg/206028/659893/#msg_659893
Celal2011-03-15T22:23:15-00:00