Madhusudana
Madhusudana

Reputation: 302

IBM JDK throwing error 0 class {0} is already woven and has not been built in reweavable mode [Xlint:nonReweavableTypeEncountered]

We have few aspects, Aspect classes are defined with @Aspect and declared the same aspect in METAINFO/aop.xml:

aop.xml

<aspectj>
    <weaver options="-Xset:weaveJavaxPackages=true">
       <include within = "Test"/>
    </weaver>
    <aspects>
        <aspect name = "Test"/>
 </aspects>
</aspectj>

Below error is thrown only in IBM JDK environment with WebSphere.

Exception:

Error at Test.java::0 class {0} is already woven and has not been built in reweavable mode [Xlint:nonReweavableTypeEncountered]


The same code works with Tomcat + Oracle JDK stack combination.

Upvotes: 0

Views: 1085

Answers (1)

Madhusudana
Madhusudana

Reputation: 302

As per AspectJ Configuration.

Aspect does not require to add it to the Weaver tag, which was causing error to thrown in SystemOut.log of WAS.

<aspectj>
    <weaver options="-Xset:weaveJavaxPackages=true">
      // add only actual classes to be woven.
    </weaver>
    <aspects>
        <aspect name = "Test"/>
 </aspects>
</aspectj>

An aop.xml file contains two key sections: "aspects" defines one or more aspects to the weaver and controls which aspects are to be used in the weaving process; "weaver" defines weaver options and which types should be woven.

https://www.eclipse.org/aspectj/doc/next/devguide/ltw-configuration.html

Upvotes: 0

Related Questions