[jboss-user] [JBoss AOP] - Interceptor not geting executed in a WAR

chandra_88 do-not-reply at jboss.com
Wed Feb 27 12:33:45 EST 2008


Hi, 

I have a simple interceptor code and a servlet . When the servlets gets executed i wanted the Interceptor to log a message . The code is all tehre but the interceptor is failing to log it . I am sure this is related to packaging iam able to access the servlet but nothing gets logged in the conosle. 

This is My packaging structure 

MyServletTest.war 
       
       - WEB- INF
                     - lib 
                     - classes
                     - web.xml

Under lib folder i have kept a jar file suffixed as Test.aop inside which contains the jboss-aop.xml under the meta-inf directory and the aspect classes. 


  | This is my Aspect class 
  | public class AspectTest implements Interceptor {
  | 	
  | 	private Logger myLog = Logger.getLogger("AspectTest");
  | 		
  | 	public Object invoke(Invocation invocation) throws Throwable {
  | 	 
  | 		String name = invocation.getTargetObject().getClass().getName();
  | 		java.lang.reflect.Method m = ((MethodInvocation)invocation).getMethod();
  | 		System.out.println("Entering method " + "inside class" + name + m.getName());
  | 		try{
  | 			return invocation.invokeNext();
  | 		}
  | 		finally{
  | 		
  | 			System.out.println("Exiting Method " + m.getName());
  | 		}
  | 	}
  | 	
  | 	public String getName()
  | 	{
  | 		return "AspectTest";
  | 	}
  | 

The servlet is quite straightforward , however when i access the servlet i expected a message to be displayed as per the interceptor but nothing gets shown . I tried to understand the injboss tutorial but applying that this is the package structure i thought 

Any suggestions , thanks in advance. 



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

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



More information about the jboss-user mailing list