Search code examples
springjakarta-eewebsphereaspectj

using Aspectj on Websphere


we are using Aspectj compile time loading in Spring source tool suite..when we are trying to deploy this project on websphere server ,we are getting following exception .this project work fine on the tomcat server..is there is some problem with libraries as AspectJ compiler is are already there in Spring Source Tool.

Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions
(1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: 
Property 'exceptionProp' threw exception; nested exception is java.lang.NoSuchMethodError:   org/aspectj/runtime/internal/AroundClosure.linkClosureAndJoinPoint(I)
Lorg/aspectj/lang/ProceedingJoinPoint

Solution

  • WebSphere ships with it's own version of AspectJ Runtime. It is installed in:

    base_${version}/lib/aspectjrt.jar

    Flipping the class loader order from 'parent first' to 'parent last' won't work -- you'll have to take a different route.

    1. Create a Shared Library (in the WebSphere Admin Console)
    2. Add your version of AspectJ to this Shared Library
    3. Create a new Classloader for your application or server and attach this classloader to it.

    Instructions on how do to this can be found on IBM's website:

    http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/tcws_sharedlib.html