Community

Wrong type of advice when using @Bind annotation

created by Vjacheslav Ignatyev in JBoss AOP - View the full discussion

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

Start a new discussion in JBoss AOP at Community