By default if you weave a type that is already woven, AspectJ will use reweaving. In this mode it reverts to the original form of the byte code before any aspects have been applied and applies the previously applied aspects and any new aspects. It does them altogether to ensure consistent semantics (otherwise you might find join points created by the weaving process of applying the first aspect may unexpectedly trigger pointcuts in the new aspect). In order for reweaving to work, Aspectj has to be able to access the aspect that was previously applied. Your message “aspect X woven into A must be defined to the weaver” implies it can’t find the code for X in order to apply it again alongside your new aspect. If you are confident your new aspect won’t “trip up” over your old aspect then you could use overweaving, activated by setting ‘-Xset:overWeaving=true’ in your aop.xml. Then it will simply apply the new aspect on top of the old one (discussed here: http://andrewclement.blogspot.ca/2010/05/aspectj-overweaving.html ).
overweening might reduce your need to lump everything together, worth a try. The cflow error is probably wrapped up in this too, but really it is wise to make sure the weave can access/modify aspects involved in the weaving process - if you don’t it can lead to problems like this.
cheers, Andy
Hi Jean-Louis,
Thanks for replying. Your error seems to be quite close at least it's same jboss7 version. Per observation you seemed to use abstract aspect that I did notice it is not working for me either. Instead I use the normal class to inherit from the abstract and define directly the subclass in aop.xml .
Everything seems to work until the existing aspects in ear cannot be resolved and I am getting the following error.
- error aspect 'com.x.old.ExistingAspect' woven into
'com.x.y.ClassA' must be defined to the weaver (placed on the
aspectpath, or defined in an aop.xml file if using LTW).
- java.lang.NoSuchFieldError:
ajc$cflowStack$0 ( this seem to be because existing aspect has made use
of cflow and it's failing during ltw)
- java.lang.InstantiationError
- java.lang.NoClassDefFoundError
Thanks & Regards, Anggiat
_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxxTo change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/aspectj-users
|