[jboss-user] [JBoss AOP] New message: "Tried everything to get Interceptor working, what am I missing?"
Nick Dodd
do-not-reply at jboss.com
Mon Feb 1 07:48:40 EST 2010
User development,
A new message was posted in the thread "Tried everything to get Interceptor working, what am I missing?":
http://community.jboss.org/message/523344#523344
Author : Nick Dodd
Profile : http://community.jboss.org/people/baronDodd
Message:
--------------------------------------------------------------
I am losing the will to live with aop. Just trying to get a simple hello world Interceptor working by intercepting public methods. Using JBoss 4.3.0, have already given up on using annotations and instead gone for the xml approach.
My Interceptor:
public class MyInterceptor implements Interceptor {
@Override
public Object invoke (Invocation invocation) throws Throwable {
try {
System.out.println("Enter the joinpoint");
System.out.println(invocation.getClass());
return invocation.invokeNext ();
} finally {
System.out.println("Leave the joinpoint");
}
}
@Override
public String getName() {
return "my.packages.MyInterceptor";
}
}
My *-aop.xml in which out of desperation I am attempting to intercept all public methods as this is the only thing that creates any output:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE aop PUBLIC
-//JBoss//DTD JBOSS AOP 1.0//EN
http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd>
<aop>
<interceptor class="my.packages.MyInterceptor" scope="PER_VM"/>
<bind pointcut="execution(public * *->*(..))">
<interceptor-ref name="my.packages.MyInterceptor"/>
</bind>
</aop>
The only output I get is from Intercepting some jms classes:
12:29:35,466 INFO [STDOUT] Enter the joinpoint
12:29:35,468 INFO [STDOUT] class org.jboss.jms.client.delegate.ClientSessionDel
egate$createObjectMessage_N7497440531089519617
12:29:35,469 INFO [STDOUT] Leave the joinpoint
12:29:35,470 INFO [STDOUT] Enter the joinpoint
12:29:35,471 INFO [STDOUT] class org.jboss.jms.client.delegate.ClientProducerDe
legate$send_3961598017717988886
12:29:35,472 INFO [STDOUT] Enter the joinpoint
12:29:35,473 INFO [STDOUT] class org.jboss.jms.client.delegate.ClientSessionDel
egate$send_6145266547759487588
12:29:35,474 INFO [STDOUT] Enter the joinpoint
12:29:35,475 INFO [STDOUT] class org.jboss.jms.server.endpoint.advised.SessionA
dvised$send_7280680627620114891
12:29:35,476 INFO [STDOUT] Leave the joinpoint
12:29:35,477 INFO [STDOUT] Leave the joinpoint
I am compiling my code with the aopc
Any ideas? I am clearly missing something here.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/523344#523344
More information about the jboss-user
mailing list