[jboss-user] [JBoss AOP] - Wrong type of advice when using @Bind annotation

Vjacheslav Ignatyev do-not-reply at jboss.com
Tue Apr 13 06:40:09 EDT 2010


Vjacheslav Ignatyev [http://community.jboss.org/people/ivv-private%40yandex.ru] created the discussion

"Wrong type of advice when using @Bind annotation"

To view the discussion, visit: http://community.jboss.org/message/537111#537111

--------------------------------------------------------------
Hi, All.

I'm using JBoss AS 5.1.0.GA.
I set "BEFORE" advice, but system searching for "AROUND".
wtf?



package ru.lanit.samara.liferay;

import org.jboss.aop.AdviceType;
import org.jboss.aop.Aspect;
import org.jboss.aop.Bind;
 
@Aspect
public class NativeSQLCorrecter
{
    @Bind(type=AdviceType.BEFORE, pointcut="execution(* $instanceof{com.liferay.portal.kernel.dao.orm.Session}->createSQLQuery(..))")
    public void before() {
        System.out.println("trying");
    }
}


JBoss AS log:

> 
> com.liferay.portal.kernel.exception.SystemException: org.jboss.aop.advice.NoMatchingAdviceException: No matching around advice called 'before' could be found in ru.lanit.samara.liferay.NativeSQLCorrecter for joinpoint Method[method=public com.liferay.portal.kernel.dao.orm.SQLQuery com.liferay.portal.dao.orm.hibernate.SessionImpl.createSQLQuery(java.lang.String) throws com.liferay.portal.kernel.dao.orm.ORMException]
>   On method 'public void ru.lanit.samara.liferay.NativeSQLCorrecter.before()'
>     return value cannot be void (it must match the joinpoint return type)
>     at com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryFinderImpl.findByDisplayDate(AnnouncementsEntryFinderImpl.java:218)
>     at com.liferay.portlet.announcements.service.impl.AnnouncementsEntryLocalServiceImpl.checkEntries(AnnouncementsEntryLocalServiceImpl.java:130)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>  ...
> 


--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/537111#537111]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100413/57efbd2b/attachment.html 


More information about the jboss-user mailing list