Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] problems running in jboss only: aop concrete aspectextending abstract aspect extending ordinary abstract base class

Hi Robert,

I can't immediately see what the problem is - but I don't have a lot of experience running code under jboss.

Does it make any difference if the concrete aspect is expressed in code rather than in XML?

@Aspect
public class DukesBank$Aspect extends com.verisign.aspectj.
j2ee.tutorial.ebank.SimpleAspect {
  @Pointcut("execution(* com.sun.ebank..*.*(..)) || execution(*.new(..))")
  public void scope();
}

Actually, now I read the pointcut properly, I wonder if it is related to the super type being caught by the advice - did you mean to not specify a package for the constructors you want to match? (Not quite sure why this makes a difference only within jboss though).  If you observe the weaveinfo messages coming out (by turning on showWeaveInfo) - does anything unusual get woven when running under JBoss in the failing case?

cheers,
Andy.


2008/7/21 Buck, Robert <rbuck@xxxxxxxxxxxx>:
Sorry, typo...

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Buck, Robert
Sent: Monday, July 21, 2008 1:48 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] problems running in jboss only: aop concrete
aspectextending abstract aspect extending ordinary abstract base class

Hi,

I am having a problem when deploying aspects having abstract
base-classes into jboss

Here are three use cases that I run into problems with...

An abstract aspect is referenced in an aop.xml file:

       <concrete-aspect name="$com.sun.ebank.DukesBank$Aspect"
extends="com.verisign.aspectj.j2ee.tutorial.ebank.SimpleAspect">
         <pointcut name="scope" _expression_="execution(*
com.sun.ebank..*.*(..)) || execution(*.new(..))"/>
       </concrete-aspect>

And SimpleAspect itself extends an abstract base class that provides
utility functions which @Before and @After methods use.

       @Aspect
       public abstract class SimpleAspect extends
AnOrdinaryAbstractBaseClass {

           @Pointcut
           public abstract void scope();

           @Before("scope()")
           public void before(JoinPoint jp) {
               super.before(jp);
               System.out.println("before: " +
jp.getStaticPart().getSignature().getDeclaringTypeName());
           }

           @After("scope()")
           public void after(JoinPoint jp) {
               super.after(jp);
               System.out.println("after: " +
jp.getStaticPart().getSignature().getDeclaringTypeName());
           }
       }

Case 1 (works):

Run "junit" code that triggers the aspect to be run; you get the
expected "before/after" output.

Case 2 (**FAILS**):

Run the DukesBank demo application within jboss, which triggers the
aspect. The aspect and the aop.xml file is located inside a jar placed
in the jboss/server/default/lib directory. You get exceptions being
thrown from:

   public static DukesBank$Aspect aspectOf()
   {
       if(ajc$perSingletonInstance == null)
           throw new
NoAspectBoundException("$com.sun.ebank.DukesBank$Aspect",
ajc$initFailureCause);
       else
           return ajc$perSingletonInstance;
   }

Case 3 (**WORKS**) :

Change the aspect slightly... Remove the "extends Base" and comment out
the "super.*(jp)" calls. Rerun jboss, and it works properly.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top