[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Strange problem of aspectizing EJBs

vola do-not-reply at jboss.com
Mon Jul 9 18:53:48 EDT 2007


Hi all,

My jboss: 4.0.5 GA. JDK:1.5.0.12. JBoss AOP 1.5.5.

I have done all configuration tutorial asks to run AOP. Also, I have successfully run "injbossaop" example. I tried to modify "Duke's Bank" J2EE application of Sun to use loadtime weaving. It is very strange that I could successfully aspectize the methods of "Servlets", but fail when aspectizing EJBs.

My jboss-aop.xml:

  |    <typedef name="MyServlets" expr="class($instanceof{javax.servlet.http.HttpServlet})"/>
  |    <bind pointcut="execution(* $typedef{MyServlets}->service(..))">
  |        <interceptor class="com.sun.ebank.aop.SimpleInterceptor2"/>
  |    </bind>
  | 
  |    <typedef name="MySessionBeans" expr="class($instanceof{javax.ejb.SessionBean})" />	
  |    <bind pointcut="execution(* $typedef{MySessionBeans}->withdraw(..))">
  |        <interceptor class="com.sun.ebank.aop.SimpleInterceptor2"/>
  |    </bind>
  | 
  |    <bind pointcut="execution(* com.sun.ebank.ejb.tx.TxControllerBean->withdraw(..))">
  |        <interceptor class="com.sun.ebank.aop.SimpleInterceptor2"/>
  |    </bind>
  | 
  |    <bind pointcut="execution(com.sun.ebank.ejb.tx.TxControllerBean->new(..))">
  |        <interceptor class="com.sun.ebank.aop.SimpleInterceptor2"/>
  |    </bind>
  | 
  |    <bind pointcut="all(com.sun.ebank.ejb.tx.*)">
  |        <interceptor class="com.sun.ebank.aop.SimpleInterceptor2"/>
  |    </bind>
  | 

As you can see, I tried different ways to aspectize the EJBs. But only the first binding "MyServlets" can be aspectized. (SimpleInterceptor2.class prints out debug msg)

In the "injbossaop" example, it aspectizes "ExampleSessionBean.class" with no problem. Could anyone have any ideas what I should do to make JBoss AOP work with EJBs, please?

Thank you


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062190#4062190

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062190



More information about the jboss-dev-forums mailing list