JBoss Community

Re: Wrong type of advice when using @Bind annotation

created by andrewwot in JBoss AOP - View the full discussion

We are experiencing the same issue with before/after lightweight advices inside container, JBoss AS 5.1.0, with both xml and annotation configuration

 

AOP version  2.1.6.GA_CP01

 

Xml Configuration

<?xml version="1.0" encoding="UTF-8"?>

<aop xmlns="urn:jboss:aop-beans:1.0">

    <aspect class="com.intuit.cg.services.ds.aop.DocTypeResourceAspect"

        scope="PER_VM" />

    <bind

        pointcut="execution(* com.intuit.cg.services.ds.docstore.service.resource.DocTypeResourceImpl->*(..))">

        <before name="beforeAdvice" aspect="com.intuit.cg.services.ds.aop.DocTypeResourceAspect" />

   </bind>

</aop>

 

Aspect class

public class DocTypeResourceAspect  {

 

 

 

 

   @Override

    public void beforeAdvice(@JoinPoint JoinPointBean joinPointBean)

    {

 

        super.beforeAdvice(joinPointBean);

        getLogger().info("beforeInvoke:" + joinPointBean);

    }

 

}

 

Exception we are getting:

org.jboss.aop.advice.NoMatchingAdviceException: No matching around advice called 'beforeAdvice' could be found in com.intuit.cg.services.ds.aop.DocTypeResourceAspect for joinpoint Method[method=public javax.ws.rs.core.Response com.intuit.cg.services.ds.docstore.service.resource.DocTypeResourceImpl.getDocTypes()]

  On method 'public void com.intuit.cg.services.ds.aop.DocTypeResourceAspect.beforeAdvice(org.jboss.aop.joinpoint.JoinPointBean)'

    @JoinPoint-annotated parameter is not assignable from expected type class org.jboss.aop.joinpoint.MethodInvocation

    at org.jboss.aop.advice.annotation.AdviceMethodFactory.findAdviceMethod(AdviceMethodFactory.java:295)

    at org.jboss.aop.instrument.JoinPointGenerator$AdviceSetups.<init>(JoinPointGenerator.java:1612)

    at org.jboss.aop.instrument.JoinPointGenerator.initialiseAdviceInfosAndAddFields(JoinPointGenerator.java:537)

    at org.jboss.aop.instrument.JoinPointGenerator.generateJoinpointClass(JoinPointGenerator.java:367)

    at org.jboss.aop.instrument.JoinPointGenerator.doGenerateJoinPointClass(JoinPointGenerator.java:285)

    at org.jboss.aop.instrument.JoinPointGenerator.access$300(JoinPointGenerator.java:77)

    at org.jboss.aop.instrument.JoinPointGenerator$GenerateJoinPointClassAction$2.generateJoinPointClass(JoinPointGenerator.java:1730)

    at org.jboss.aop.instrument.JoinPointGenerator.generateJoinPointClass(JoinPointGenerator.java:250)

    at org.jboss.aop.GeneratedClassAdvisor.generateJoinPointClass(GeneratedClassAdvisor.java:1047)

    at com.intuit.cg.services.ds.docstore.service.resource.DocTypeResourceImpl$DocTypeResourceImplAdvisor.getDocTypes_N_5161450178620338716(DocTypeResourceImpl$DocTypeResourceImplAdvisor.java)

 

Classical around advices and interceptor work just fine, we even tried to modify aop.xml to explicitly use

<property name="instrumentor">org.jboss.aop.instrument.GeneratedAdvisorInstrumentor</property>

even that it's supposed to be default instrumentor, but it didn't help.

 

What version of container supports lightweight advices?

Reply to this message by going to Community

Start a new discussion in JBoss AOP at Community