1 Reply Latest reply on Nov 15, 2005 11:06 AM by Kabir Khan

    Running AOP in the container

    Thomas Orr Newbie

      I cannot seem to get AOP working in the container. I was hoping to use load time weaving to apply an aspect to an already deployed class, but it does not seem to work. Maybe I'm missing something.

      Using JDK5, JBoss4.0.3SP1 (all).

      I've set EnableLoadtimeWeaving to true in the deploy\jboss-aop.deployer\META-INF\jboss-service.xml file.

      I've deployed a war containing the class that I want aspectized. I created a seperate .aop file containing the aspect and the appropriate -aop.xml file. The aspect does not do anything more than the example:

      public class Trackable implements Interceptor {
       * @see org.jboss.aop.advice.Interceptor#getName()
       public String getName() {
       return "Trackable";
       * @see org.jboss.aop.advice.Interceptor#invoke(org.jboss.aop.joinpoint.Invocation)
       public Object invoke(Invocation invocation) throws Throwable {
       long startTime = System.currentTimeMillis();
       try {
       return invocation.invokeNext();
       } finally {
       long endTime = System.currentTimeMillis() - startTime;
       java.lang.reflect.Method m = ((MethodInvocation) invocation).getMethod();
       System.out.println("method " + m.toString() + " time: " + endTime
       + "ms");

      I deploy the .aop file to the deployment directory. The console says that it is deployed. I navigate to my web app in the browser. I see nothing in the console - no errors, no System.outs. Am I missing something?