-
1. Re: Wrong type of advice when using @Bind annotation
flavia.rainone Apr 22, 2010 9:43 AM (in response to ivv-private)This error you are seeing is totally unexpected, as this feature is part of our testsuite.
What is the version of JBoss AOP you are using? (you can check on the manifest of jboss-aop.jar in the server)
Have you tried this scenario on JBoss AOP standalone?
-
2. Re: Wrong type of advice when using @Bind annotation
andrewwot Jan 25, 2011 7:29 PM (in response to flavia.rainone)We are experiencing the same issue with before/after lightweight advices inside container (JBoss AS 5.1.0) with both xml and annotation configurations
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="DocTypeResourceAspect"
scope="PER_VM" />
<bind
pointcut="execution(* DocTypeResourceImpl->*(..))">
<before name="beforeAdvice" aspect="DocTypeResourceAspect" />
</bind>
</aop>
Aspect class
public class DocTypeResourceAspect {
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 DocTypeResourceAspect for joinpoint Method[method=public javax.ws.rs.core.Response DocTypeResourceImpl.getDocTypes()]
On method 'public void 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 DocTypeResourceImpl$DocTypeResourceImplAdvisor.getDocTypes_N_5161450178620338716(DocTypeResourceImpl$DocTypeResourceImplAdvisor.java)
Classical around advices and interceptors 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 actually supports lightweight advices?
Thanks
-
3. Re: Wrong type of advice when using @Bind annotation
flavia.rainone Jan 26, 2011 4:01 PM (in response to andrewwot)AFAIK, your example should work. I'll investigate to see what is going on.
-
4. Re: Wrong type of advice when using @Bind annotation
andrewwot Feb 1, 2011 1:50 PM (in response to flavia.rainone)Hi Flavia, any update on that, we are using load time weaving if that's matter?
Thanks
-
5. Re: Wrong type of advice when using @Bind annotation
flavia.rainone Feb 1, 2011 4:11 PM (in response to andrewwot)Sorry, Andrew, but not yet. I'll check this later this week.
-
6. Re: Wrong type of advice when using @Bind annotation
flavia.rainone Feb 7, 2011 8:33 AM (in response to andrewwot)Have you checked the version of jboss-aop.jar in the container? If yes, I would try installing the latest JBoss AOP version available for download. There is a jboss-50-install script at the distribution zip file that could be used for that. If the error persists, let me know.
-
7. Re: Wrong type of advice when using @Bind annotation
andrewwot Feb 7, 2011 3:49 PM (in response to flavia.rainone)Hi Flavia, the AOP version was specified in my mesage, it's 2.1.6.GA_CP01. We could not use the latest version of JBoss AOP with JBoss EAP 5.0 or 5.1 due to some libraries incompatibilites. Plus replacing component versions in EAP release is not officially supported.
Can you please tell us which version worked for you and if possible started from which version lightweight aspects have become functional inside the container.
Thanks again for your help,
Andrew