Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Instrumenting JDKs

> 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 <tiago@xxxxxxxxxx> 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@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top