7 Replies Latest reply on Jul 12, 2004 4:42 PM by Bill Burke

    Another test that not execute correctly...

    Eduardo Yáñez Parareda Newbie

      Hi again, although anybody answer my questions I still try that JbossAOP works for me.

      How I've not get that an application under Tomcat with JBossAOP works fine, then I'm going
      to try n standalone application.

      Main class:


      package es.pfc.test;

      public class TestAOP {

      public TestAOP() {

      super();

      }

      public void execute() {

      System.out.println("Test de AOP");

      }

      public static void main(String[] args) {
      try {

      new TestAOP().execute();

      } catch (Throwable th) {

      th.printStackTrace();

      }
      }
      }


      Interceptor class:

      package es.pfc.test.aop;

      import org.jboss.aop.advice.Interceptor;
      import org.jboss.aop.joinpoint.Invocation;
      import org.jboss.aop.joinpoint.MethodInvocation;

      public class MethodAuthorizationInterceptor implements Interceptor {

      public String getName() {

      return getClass().getName();

      }

      public Object invoke(Invocation invocation) throws Throwable {

      MethodInvocation mInvocation = (MethodInvocation) invocation;
      String method = mInvocation.getMethod().getName();
      System.out.println("Interceptado el metodo - " + method);
      return invocation.invokeNext();

      }
      }


      jboss-aop.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      < aop>
      < bind pointcut="execution(public * es.pfc.test.*->*(..))">
      < interceptor class="es.pfc.test.aop.MethodAuthorizationInterceptor"/>
      < /bind>
      < /aop>


      When I run TestAOP I get this message:

      Exception in thread "main" java.lang.StackOverflowError

      I've not got any stack trace. What's wrong in my test?