[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] How to advise already loaded classes using LTW?
|
Hi Eric.
I do not really want to imagine what makes you think you need/want to advise container classes. I would assume that there must be a better way to technically achieve what you want. You said the problem was about the legacy application, not about the container.
Anyway, for what it is worth, in principal you can, if you can influence how the container is started, apply binary weaving to container classes and put aspectjrt.jar on the JVM boot classpath. As for the third party library (Struts), it would be interesting to find out what causes the class visibility problem you mentioned. But even if you do not find out, you can still apply binary weaving to all JARs in your EAR, repackage the woven version and also use it in connection with aspectjrt.jar. No LTW means no LTW-related problems.
I am pretty sure there also is a way to fix the LTW situation, but I can only speculate about it because I am not really a container champion. Maybe if I had the binaries and exact setup to locally reproduce the problem... Maybe you can find out more by setting the appropriate debug logging options in your container as well as in AspectJ itself.
As for retransforming already loaded classes, I once tried but failed because either it is not possible or just because I do not know enough about the JVM. In order to manually handle that.
As I said: if I were you I would try to reduce the situation's complexity by using binary weaving instead of LTW. Just my two cents. Probably Andy has a much better answer for you, as usual. :-)
Regards -- Alexander Kriegisch
Hi Alex,
Actually, there are some struts classes I want to advise. But I have 2 issues (related but distinct) with approach #1.
1) I an able to advise the struts classes, but cannot use any of the struts class definitions as they are not exposed to the aspect. That means if I was to access any arguments that are struts classes (parameters or return values) as anything more than mere Object, I can't. I get ClassDefNotFound exceptions.
2) I would like to advise some container (JEE) classes, but they aren't advisable either as they have already been loaded by then time the container loads my aspect jar.
I haven't actually tried using call() instead of execution() yet; it only occurred to me as I was writing my post. But I suspect you are court that it won't make a significant difference, as the calls are made from within the framework itself (which are already loaded).
Is there any way out of this mess? Is there anyway to use something like cflow()? Is there no way to advise an already loaded class?
Thanks
Eric
|
Attachment:
smime.p7s
Description: S/MIME cryptographic signature