2 Replies Latest reply on Nov 9, 2004 12:57 PM by 12alex34

    AspectWerkz AOP with JBoss: could not load aspect

    Michael Furman Newbie

      Please help!
      I am trying to use the AspectWerkz AOP with JBoss.
      Unfortunately, I have no success.
      Please note, that I success to run the example stand alone, but when I am trying to do the same thing in JBoss I have the following exception

      java.lang.ClassNotFoundException: test.aop.LogAspect

      and the following AspectWerkz warning:

      loader: sun.misc.Launcher$AppClassLoader@e80a59
      aspectClassName: test.aop.LogAspect
      Warning: could not load aspect test.aop.LogAspect from sun.misc.Launcher$AppClassLoader@e80a59due to: java.lang.ClassNotFoundException: test.aop.LogAspect
      java.lang.ClassNotFoundException: test.aop.LogAspect


      My steps:
      1) Create aspect
      public class LogAspect
      {

      public Object aroundAdvice(JoinPoint joinPoint) throws Throwable {
      if (joinPoint == null)
      {
      return null;
      }
      MemberSignature signature = (MemberSignature)joinPoint.getSignature();
      System.out.println("-->: " + joinPoint.getTargetClass().getName() + "::" + signature.getName());
      try {
      return joinPoint.proceed();
      } finally {
      System.out.println("<--: " + joinPoint.getTargetClass().getName() + "::" + signature.getName());
      }
      }


      }


      2) Create aop.xml ( created WITH < and /> characters )


      aspectwerkz
      system id="AspectWerkzExample"

      package name="test.aop"

      aspect class="LogAspect"
      pointcut name="pc1" expression="execution(* est.aop.TestMe.foo*(..))"
      advice name="aroundAdvice" type="around" bind-to="pc1"
      aspect
      package
      system
      aspectwerkz


      3) Create application

      public class TestMe1
      {

      public void foo() {
      System.out.println("foo body");
      }
      }



      4) Offline weaving of application
      5) Packing the aspect, application and aop.xml in the same EAR file
      6) Deployed EAR
      7) Calling to the foo method

      TestMe1 testMe = new TestMe1();
      testMe.foo();


      Please help!
      Best regards,
      Michael