Skip to main content

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

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.clement@xxxxxxxxx>
> 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
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top