[jboss-user] [JBoss AOP] - Newbie help needed

bdruth do-not-reply at jboss.com
Wed Aug 16 14:49:36 EDT 2006


Good afternoon -

I am trying to use JBoss AOP 1.5 annotations, and I think I'm missing something.

I have defined an annotation:

@Retention(RetentionPolicy.RUNTIME)
  | @Target({ ElementType.METHOD })
  | public @interface MyAnnotation{
  | }

And I have applied this annotation to a method:

	@MyAnnotation
  | 	public static void testAdvice() throws InterruptedException {
  | 		// do something
  | 	}
  | 

I have created & annotated an 'Aspect' -

@Aspect (scope = Scope.PER_VM)
  | public class MyAdvice {
  | 
  | 	/**
  | 	 * Default public constructor.
  | 	 *
  | 	 */
  | 	public MyAdvice() {
  | 	}
  | 	
  | 	/**
  | 	 * Invokes the advice on the provided invocation (method call).
  | 	 * @param invocation The method call to advise
  | 	 * @return The result of the invocation
  | 	 * @throws Throwable Thrown from {@link Invocation#invokeNext invokeNext()}
  | 	 */
  | 	@Bind (pointcut = "execution(* *->@com.package.name.MyAnnotation(..))")
  | 	public Object invoke(Invocation invocation) throws Throwable {
  | 		try {
  | 			obj = invocation.invokeNext();
  | 		} finally {
  | 			// do something
  | 		}
  | 		
  | 		return obj;
  | 	}
  | }
  | 

Nothing in jboss-aop.xml ... unfortunately, the Aspect is never invoked. I've set breakpoints, no use. I'm running under JBoss IDE in Eclipse, using a JBoss AOP Application launch configuration, amended with a -javaagent: argument that provides the path to jboss-aop-jdk50.jar (in eclipse/plugins/.../)

No errors, no output, nothing happens.

Guidance would be appreciated.

Respectfully,
Brice Ruth

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

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



More information about the jboss-user mailing list