[jboss-user] [JBoss AOP] - I can't get AOP to cross cut ... Please help

wgmartinez do-not-reply at jboss.com
Tue Apr 3 07:33:50 EDT 2007


I've installed jboss-aop-jdk50.deployer on JBoss4.0.5GA, wrote below aspect 

public class LoggerAspect {
    
    private static Logger log = Logger.getLogger(LoggerAspect.class);
    
    public Object logInvocation (Invocation invocation) throws Throwable {
        
        if (invocation instanceof MethodInvocation){
            MethodInvocation method = (MethodInvocation) invocation;
            log.info("Method: " + method.getActualMethod() + " invoked.");
            System.out.println("Method: " + method.getActualMethod() + " invoked.");
        }
        
        if (invocation instanceof FieldInvocation){
            FieldInvocation field = (FieldInvocation) invocation;
            log.info("Field: " + field.getField() + " invoked.");
            System.out.println("Field: " + field.getField() + " invoked.");
        }
        
        if (invocation instanceof ConstructorInvocation){
            ConstructorInvocation constructor = (ConstructorInvocation) invocation;
            log.info("Constructor: " + constructor.getConstructor() + " invoked.");
            System.out.println("Constructor: " + constructor.getConstructor() + " invoked.");
        }
        
        return invocation.invokeNext();
    }
    
}

then configure the binding in a jboss-aop.xml as below:


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


    
    
        
            


and put the file in the META-INF directory. I then included the aspect and the xml in the same jar file as the class I'm trying to cross cut which is a message bean, but I can't see anything happening.

What am I doing wrong?

Thanks
W

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034002#4034002

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034002



More information about the jboss-user mailing list