[jboss-user] [JBoss AOP] - Interceptor is applied 16 times instead of 1

thomas.larsson@jayway.se do-not-reply at jboss.com
Sun Sep 16 15:20:02 EDT 2007


Hi everyone,

We have a number of Stateless Session Beans (EJB3) for which we want to apply a logging interceptor. When we run a call to the bean, the aspect is applied 16 times for some reason. 

Here is our aop.xml 

  | <?xml version="1.0"?>
  | <aop>
  | 	<bind pointcut="execution(public * com.dts.*->*($instanceof{com.dts.commons.serviceplatform.DTSMessage}))">
  | 		<interceptor class="com.dts.serviceplatform.interceptors.impl.DTSLoggingInterceptor" scope="PER_VM"/>
  | 	</bind>
  | </aop>
  |  

Here is the interceptor

  | public class DTSLoggingInterceptor implements Interceptor {
  | 	
  | 	public Object invoke(Invocation invocation) throws Throwable {
  | 		
  | 		Object param  = ((MethodInvocation)invocation).getArguments()[0];
  | 		System.out.println("Request: " + IOUtil.toXML(param));
  | 		
  | 		Object result = invocation.invokeNext();
  | 		if(result!=null) {
  | 			System.out.println("Response: " +IOUtil.toXML(result));
  | 		}
  | 		return result;
  | 	}
  | 
  | 	public String getName() {
  | 		return "DTSBusinessMessageLogInterceptor";
  | 	}
  | }
  | 

We are using Jboss AS 4.2.1.GA with jboss-aop 1.5.0.GA with JDK1.5.0_11.

Any tips?

-Thomas

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

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



More information about the jboss-user mailing list