Announcement Announcement Module
Collapse
No announcement yet.
proxying AOP dependency runtime issue with spring 2.0.6 for after-returning advice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • proxying AOP dependency runtime issue with spring 2.0.6 for after-returning advice

    Hello,

    I am a newbie at Spring AOP and it appears that I am having compatibility issues with dependencies.



    I am using spring version 2.0.6 and and doing proxying AOP.



    Spring config snippet

    ……

    <bean name="projectsDao"

    class="com.markettools.aop.domain.ProjectsDao">

    </bean>

    <bean name="securityAdviser"

    class="com.markettools.aop.advise.SecurityAdviser" >

    </bean>

    <aop:config>

    <aopointcut id="activityCheckPointCut"

    expression="execution(* com.markettools.aop.domain.ServiceFacade.*())"/>

    <aopointcut id="filterResultsPointCut"

    expression="execution(* com.markettools.aop.domain.ProjectsDao.*())"/>

    <aop:aspect id="myAspect" ref="securityAdviser">

    <aop:before pointcut-ref="activityCheckPointCut" method="checkMethodAccessSecurity" />

    <aop:after-returning pointcut-ref="filterResultsPointCut" method="filterResults" returning="retVal"/>

    </aop:aspect>

    </aop:config>

    …….

    SecurityAdviser snippet



    /**

    * DOCME!

    *

    * @since 9/17/07

    */

    public void filterResults(Object retVal) {





    System.out.println("do nothing for now");

    }





    To make ‘before’ advice work I had to declare dependencies on aspectj weaver and aspectjrt 1.5.3, asm 2.2.3 and cglib 2.1_3 – this is the only combination I was able to make it run successfully, but it runs as expected.



    However, when I am trying to create ‘after-returning’ advice, I am getting runtime exceptions



    Caused by: java.lang.AbstractMethodError: org.springframework.core.LocalVariableTableParamet erNameDiscoverer$FindMethodParameterNamesClassVisi tor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/StringV

    at org.objectweb.asm.ClassReader.accept(Unknown Source)

    at org.objectweb.asm.ClassReader.accept(Unknown Source)

    at org.springframework.core.LocalVariableTableParamet erNameDiscoverer.visitMethod(LocalVariableTablePar ameterNameDiscoverer.java:98)



    I suspect my dependency list is incorrect but I am having hard time figuring the correct dependencies and their versions.

    Thanks

  • #2
    solution

    i figured it out - the trick is to make sure that cglib does not pull it it's dependencies during build as it depends on older version of asm.

    this mvn configuration seem to work
    <dependency>
    <groupId>aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.5.3</version>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>1.5.3</version>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>asm</groupId>
    <artifactId>asm-all</artifactId>
    <version>2.2.3</version>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>2.1_3</version>
    </dependency>

    Comment

    Working...
    X