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


> On Feb 16, 2015, at 7:50 PM, Anggiat Barita <anggiat.bar...@gmail.com> wrote:
> 
> 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
> 
> On Mon, Feb 16, 2015 at 6:25 PM, jlp <jean-louis.pastu...@orange.fr 
> <mailto:jean-louis.pastu...@orange.fr>> wrote:
> Humm, you seem to have the same problem I got a long time ago :
> 
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=406817 
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=406817>
> 
> the bug is still open and certainly due to the JBoss ClassLoader strategy of 
> the micro_kernel ( It is a OSGi like).
> I have no tried to package aspectjweaver.jar + custom aspects as a JBoss 
> module... perhaps it is a solution ...
> 
> The thread i exchanged with Andrew Clement => 
> https://www.mail-archive.com/aspectj-users@eclipse.org/msg08250.html 
> <https://www.mail-archive.com/aspectj-users@eclipse.org/msg08250.html>
> 
> <OT>
> To do "LTW weaving like" with JBoss, i must switch to Byteman => 
> http://byteman.jboss.org/ <http://byteman.jboss.org/>
> I got more weaving. But some others guys have encounted  problems also with 
> Byteman , due to the Classloader =>  
> https://developer.jboss.org/thread/248812 
> <https://developer.jboss.org/thread/248812>
> I have also begun a byteman packager =>https://github.com/PASTJL/bytemanPkg 
> <https://github.com/PASTJL/bytemanPkg>
> </OT>
> 
> 
> Le 16/02/2015 05:11, Anggiat Barita a écrit :
>> 
>> 
>> Hi All,
>> 
>> I have been using aspectj ctw successfully with my application deployed into 
>> Jboss 7.
>> 
>> Due to some requirement, I need to create and apply new aspects during LTW 
>> only but I am facing many warnings and errors.
>> 
>> I have followed the steps given from https://wiki.eclipse.org/LTWJboss7 
>> <https://wiki.eclipse.org/LTWJboss7> and I am using the latest 1.8.4 version 
>> of aspectj .
>> 
>> My humble and novice questions to all the users here are :
>> Is it possible to run Jboss7 aspects the were pre-compiled bundled within 
>> war/ear together with different aspects in the separate JAR to be loaded 
>> during LTW ? I have tried combination -Djboss.modules.system.pkgs whether to 
>> include new aspect package and existing aspect package. ( the aspect 
>> packages are different, com.x.old.* and com.x.new.*) 
>> If yes, should the separate JAR need to contain all of the aspects to run or 
>> just the new delta aspects  ?
>> When it's separate, i am getting the following error msg.
>> 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
>> Even I have the existing aspect defined within aop.xml, the same error 
>> remains
>> I even define the aspect but exclude the existing aspects but no luck on 
>> that as well
>> After this step I actually combine everything as per below questions #3
>> If not, I have re-bundled all aspects into one separate JAR but I am facing 
>> the following errors, as if the bundled jar files unable to resolve the 
>> classes within war java.lang.NoSuchFieldError
>> java.lang.InstantiationError
>> java.lang.NoClassDefFoundError
>> I appreciate any help and advices to pass through this problems. Sorry the 
>> long winded question, if it's not clear please ask I can elaborate more on 
>> the errors.
>> Thanks & Regards,
>> 
>> Anggiat
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org>
>> To change your delivery options, retrieve your password, or unsubscribe from 
>> this list, visit
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
>> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org>
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to