Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspect reweaving error

>I am executing the command as below,
>COMMAND: ajc -inpath woven_hello1.jar -aspectpath aspect2.jar -outjar woven_hello2.jar

Aha! That's interesting. I had assumed you were doing LTW from the discussion of aop.xml. You've fallen victim of an inappropriate compiler message. It is true that you must define aspect1 to the weaver, but the message you're getting:

> woven_hello1.jar [error] aspect 'aspect1' woven into 'Hello' must be declared in an aop.xml file.

should only be issued in this form when doing load time weaving: the aop.xml file is currently only used when doing load-time weaving, so whatever you put in there is going to make no difference to the command you are executing.

You need to add aspect1.jar to the *aspectpath* (not the classpath) for this command to work.

If you want to 'remove' all effects of the aspects in aspect1.jar - as opposed to weaving the aspects in aspect2.jar in addition to those in aspect1.jar then you can do this by creating e.g. aspect1-remove.jar which contains all the same aspect types as aspect1.jar, but with no content in the aspect types.

For example:

public aspect SomeAspectPreviouslyPackagedInAspect1Jar {
  // deliberately empty
}


Now put aspect1-remove.jar on the aspectpath instead of aspect1.jar. This will have the effect of 'removing' any advice etc. that was woven as a result of weaving with the previous versions of these types.

I've raised bug 141945 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=141945) to cover the confusing error message that you were seeing.

Regards, Adrian.

On 15/05/06, Kalyani Jitesh <j-kalyani@xxxxxxxxxxxxxxxxx> wrote:
Hi Adrian,
 
Thank you very much for your reply. But It did not solve my problem.
I want to weave aspect2.jar only in woven_hello1.jar, My goal is to weave aspect2.jar and remove previously woven aspect1.jar from binary. Is it possible?
Sorry my goal was not clear from previous mail.
 
As I have mentioned in my previous mail I have the aop.xml which look as below,
which is placed in my 1st time woven archive, woven_hello1.jar,
<aspectj>
  <aspects>
  <aspect name="aspect1"/>
  </aspects>
</aspectj>

I have also tried,
<aspectj>
  <aspects>
  <aspect name="aspect1"/>
  <aspect name="aspect2"/>
  </aspects>
</aspectj>

 
Both above case did not work.
 
I am executing the command as below,
 
COMMAND: ajc -inpath woven_hello1.jar -aspectpath aspect2.jar -outjar woven_hello2.jar
 
I am getting same old error,
woven_hello1.jar [error] aspect 'aspect1' woven into 'Hello' must be declared in an aop.xml file.
(no source information available)
I have placed both aspect1.class and aspect2.class in CLASSPATH system variable.
 
Can you please help me to resolve the problem. Thanks in advance.
 
Regards,
Jitesh
 
 
Date: Fri, 12 May 2006 09:58:35 +0100
From: "Adrian Colyer" <
adrian.colyer@xxxxxxxxx>
Subject: Re: [aspectj-users] aspect reweaving error
To:
aspectj-users@xxxxxxxxxxx
Message-ID:
<
7079d79e0605120158j77b7d02cv655cb3f077ecee74@xxxxxxxxxxxxxx >
Content-Type: text/plain; charset="iso-8859-1"

When you are doing the second weave, you need to add

  <aspect name="aspect1"/>

into the <aspects> section of your aop.xml. AspectJ requires both any
aspects that types were originally woven with to be defined in addition to
any new aspects.

On 12/05/06, Kalyani Jitesh <
j-kalyani@xxxxxxxxxxxxxxxxx > wrote:
>
>  HI There,
>
> Am trying to reweave the aspects in woven application archive with
> aspectJ1.5.1a version.
>  I have followed the following steps,
>
> 1. At 1st I have woven aspect1.class in woven_hello.jar compile time using
> ajc compiler. (aspct is woven with -reweavable option as it on by default in
> aspectJ1.5.1a). I have placed the below aop.xml in woven_hello.jar in
> META-INF folder.
>
> <aspectj>
>  <aspects>
>   <aspect name="aspect1"/>
>  </aspects>
> </aspectj>
> 2. Then I have tried weaving aspect2.class in woven_hello.jar (which is
> already woven with aspect1.class). During this step I have put the
> aspect1.class in CLASSPATH.
>
> After step 2 I am getting below error:
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> D:\javasample\inheritance\wnoffice1.jar [error] aspect 'aspect1 woven into
> 'Hello' must be declared in an aop.xml file.
> (no source information available)
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Can anyone guide me how can I reweave aspect2.class in woven_hello.jar
> after step1?
> Thanks in advance.
>
> Regards,
> Jitesh


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users





--
-- Adrian
adrian.colyer@xxxxxxxxx

Back to the top