bbarin [http://community.jboss.org/people/bbarin] created the discussion
"Cannot intercept a method" To view the discussion, visit: http://community.jboss.org/message/582723#582723 -------------------------------------------------------------- Hi I've developed a simple aspect to measure the performance of my application, but althogh the deployment of the aspect in JBoss looks correct, the method that's aimed is not intercepted. I used the following approach: - I have a performance.jar which contains the following aspect: package com.agfa.ogpc.performance.aspects; import com.agfa.ogpc.performance.dao.NeoDatisMessageProcessingDAO; import com.agfa.ogpc.performance.dao.PerformanceDAO; import org.jboss.aop.joinpoint.MethodInvocation; import com.agfa.ogpc.performance.model.TimeElapsed; public class MessageProcessingAspect { public Object intercept(final MethodInvocation invocation) throws Throwable { long startTime = System.currentTimeMillis(); try { return invocation.invokeNext(); } finally { long endTime = System.currentTimeMillis(); store(new TimeElapsed(startTime,endTime)); } } private void store(final TimeElapsed timeElapsed) { PerformanceDAO<TimeElapsed> dao = new NeoDatisMessageProcessingDAO(); dao.persist(timeElapsed); } } - I also have several .ears which are part of my application - I deployed a file named performance-aop.xml in the deploy folder, that looks like: <?xml version="1.0" encoding="UTF-8"?> <aop> <aspect class="com.agfa.ogpc.performance.aspects.MessageProcessingAspect"/> <bind pointcut="execution(* com.agfa.hap.bpe.components.db.BasicStatelessDBComponent->*(..))"> <around aspect="com.agfa.ogpc.performance.aspects.MessageProcessingAspect" name="intercept" /> </bind> </aop> The application is deployed correctly and the -aop.xml is wellformed, but the application is not intercepted and I'm sure the method is being called (I debugged the code). Then I have changed the syntax to intercept any method: <?xml version="1.0" encoding="UTF-8"?> <aop> <aspect class="com.agfa.ogpc.performance.aspects.MessageProcessingAspect"/> <bind pointcut="execution(* *->*(..))"> <around aspect="com.agfa.ogpc.performance.aspects.MessageProcessingAspect" name="intercept" /> </bind> </aop> But even after this change the aspect is not being called. I also tried to change the performance.jar to performance.aop and include a jboss-aop.xml within the META-INF folder, but without any success. So, I ran out of options for the moment.... So, anyone has any idea how to solve it? Thanks, Bruno -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/582723#582723] Start a new discussion in JBoss AOP at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
