[jboss-user] [JBoss AOP] - Newbie - Help Needed

andydale do-not-reply at jboss.com
Mon Jul 17 11:21:43 EDT 2006


Hi,

I am new to AOP and am currently running into problenm when trying to implement a custom aspect (interceptor) on JBoss 4.0.4GA.

I have already managed to write a working Interceptor by actually coding it inside the bean with the @AroundInvoke, but now i want to implement it like demonstrated here http://docs.jboss.org/jbossas/jboss4guide/r3/html/aop.chapt.html with having a .jar (custom Aspect) file, and jboss-aop.xml file in the deploy directoy, and annotation the method in the bean.  The problem i am currently having is that it never seems to fire.

TestInterrup.java (aspect interace)
package com.jboss.aspect;
  | 
  | import java.lang.annotation.Target;
  | import java.lang.annotation.ElementType;
  | 
  | @Target({ElementType.METHOD})
  | public @interface TestInterrupt {}

TestInterruptAspect.java
package com.jboss.aspect;
  | 
  | //import the relevant aop libs
  | import org.jboss.aop.joinpoint.Invocation;
  | 
  | public class TestInterruptAspect {
  | 	
  | 	public Object testInterrupt(Invocation invocation)throws Throwable{
  | 		
  | 		//test print
  | 		System.out.println("**** Interrupt fired successfully ****");
  | 		
  | 		return invocation.invokeNext();
  | 	}
  | 
  | }

jboss-aop.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  |         <aspect class="com.jboss.aspect.TestInterruptAspect"
  |           scope="PER_VM"/>
  | 
  |         <bind pointcut="execution(* *->@com.jboss.aspect.TestInterrupt(*))">
  |         <advice name="testInterrupt"
  |             aspect="com.jboss.aspect.TestInterruptAspect"/>
  |         </bind>
  | </aop>
  | 

Can anyone offer me any advice on how to solve the problem of it not firing on method invocation ?

Thanks in advance,

Andy

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

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



More information about the jboss-user mailing list