2

We are using AspectJ(1.6.12) for weaving a third party library class (SpringBeanELResolver). We enable LTW using <context:load-time-weaver/>, and our aspect uses AspectJ annotation configuration. Everything works fine on jetty with full list of classes seen on debug output of Aspectj. As documented on Spring, we don't use -javaagent since it is not needed on Websphere platform.

On Websphere 8, we see logs that Spring correctly initializes WebSphereLoadTimeWeaver, and Aspectj is correcly initalized. But we see just a portion of classes on debug output of aspectj. SpringBeanELResolver also is not included for weaving. As a result, our class is not weaved.

We can weave classes listed on debug output, e.g. our classes..

We configure Classloading policy to PARENT_LAST.

Here are some logs and configurations:

Websphere SystemErr (most of the 3rd party classes are not seen here including SpringBeanELResolver)

00000022 SystemErr     R [CompoundClassLoader@1293b09] info AspectJ Weaver Version 1.6.12 built on Tuesday Oct 18, 2011 at 17:52:06 GMT
00000022 SystemErr     R [CompoundClassLoader@1293b09] info register classloader com.ibm.ws.classloader.CompoundClassLoader@1293b09
00000022 SystemErr     R [CompoundClassLoader@1293b09] info using configuration <path-to-ear>/our_war.ear/our.war/WEB-INF/classes/META-INF/aop.xml
00000022 SystemErr     R [CompoundClassLoader@1293b09] info register aspect com.ourcompany.OurAspect
00000022 SystemErr     R [CompoundClassLoader@1293b09] debug not weaving 'org.springframework.instrument.classloading.websphere.WebSphereClassPreDefinePlugin$Dummy'
00000022 SystemErr     R [CompoundClassLoader@1293b09] debug not weaving 'org.apache.myfaces.shared_orchestra.util.ClassUtils'
00000022 SystemErr     R [CompoundClassLoader@1293b09] debug not weaving 'org.apache.myfaces.orchestra.conversation.annotations.ConversationRequire'

...

Websphere SystemOut

00000022 DefaultContex I org.springframework.context.weaving.DefaultContextLoadTimeWeaver setBeanClassLoader Determined server-specific load-time weaver: org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWeaver

aop.xml

<!DOCTYPE aspectj PUBLIC
        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
    <weaver options="-showWeaveInfo -verbose -debug">
        <!-- only weave classes in packages below-->
        <include within="org.springframework.beans.factory.access.el.*"/>
        <include within="com.ourcompany.*"/>
    </weaver>
    <aspects>
        <!-- weave in just this aspect -->
        <aspect name="com.ourcompany.OurAspect"/>
    </aspects>
</aspectj>

I think that CompoundClassLoader might have issues loading all 3rd party libraries in WEB-INF/lib or, it is something between Aspectj and CompoundClassLoader...

iesen
  • 65
  • 2
  • 11

1 Answers1

0

Since all of my Java classes in ${src.dir}, I give a source list to iajc. In source list there is only one line.

http://resultplanet.org/