Just for future reference, if other people come across the same, I have
indeed managed to successfully instrument rt.jar. The exceptions I was
experiencing had actually to do with some double-weaving that I was doing. I
was weaving the rt.jar but I had forgotten that I had also weaved a jaxws
library which I was also using.

That was causing some sort of problem, but it doesn't really matter in the
end as I didn't mean to have the jaxws library woven at this point.

Thanks again for the clarification!

Cheers,
Tiago

2011/3/16 Tiago Espinha <ti...@apache.org>

> A-ha! When I faced those issues, I googled and I found a lot of people
> facing issues with weaving into the JDK so I thought it was an actual
> limitation of AspectJ. But from what you say, it seems like the only problem
> has to do with loadtime weaving but instrumenting a JAR should be fine.
>
> Well, that's certainly good news and tomorrow I'll give it another try.
> Maybe this exception I'm facing has to do with something else...
>
> Anyway, thanks a lot!
>
> Cheers,
> Tiago
>
>
> 2011/3/16 Andy Clement <andrew.clem...@gmail.com>
>
>> > What makes it so different from instrumenting any other JAR?
>>
>> These classes are loaded by a classloader that does not get a chance
>> to attach a weaver, when using javaagent - so loadtime weaving isn't
>> possible.  With care, you can do what you have done, weave rt.jar and
>> use that new version.  The trouble is that it can be easy to cause
>> yourself problems if you, for example, weave String but also use
>> String (perhaps inadvertently) in your aspect - easy to create
>> stackoverflow issues.  I don't know why you have a NoSuchMethodError
>> though.
>>
>> But I know others have done the weaving successfully - hopefully one
>> of them can follow up my post :)
>>
>> cheers
>> Andy
>>
>> On 16 March 2011 06:19, Tiago Espinha <ti...@apache.org> wrote:
>> > Hi all,
>> > I've been looking around the Internet, and it seems like it's impossible
>> (or
>> > at least failure-prone) to weave aspects into JDKs. I did it myself - I
>> > instrumented the rt.jar file from the latest Oracle JDK for Linux - and,
>> > whilst the weaving goes seemingly fine, I hit failures on runtime with
>> such
>> > exceptions as NoSuchMethodError, relating to the aspect I wove.
>> > What I cannot understand is the reason why JDK instrumentation is
>> > impossible. What makes it so different from instrumenting any other JAR?
>> And
>> > does anyone know if there are workarounds to it?
>> > Thanks in advance!
>> > Cheers,
>> > Tiago
>> > _______________________________________________
>> > 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
>>
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to