0 Replies Latest reply on Apr 1, 2010 9:18 AM by headiron

    Is there any article about using jboss AOP with EJB 2.X

    headiron

      Hi.

       

      These days I try to use jBoss AOP with EJB 2.X.

       

      I make Aspect class and included on jar that will be include on ear.

       

      And I add a xml file to set a rule.

       

      ( Create a new file, named 'jbosstest-aop.xml', and saved on jboss/server/default/deploy dolder. )

       

      When server is started , message about depolying above xml file is displayed

       

      But I try to using it , it isn't work.

       

      Is there any article ( or document ) about using jboss AOP with EJB 2.X session bean?

       

      I use jboss4.0.2 server and , test it with jbossAOP 1.3.1

       

       

      - Content of 'jbosstest-aop.xml' -

       

      <?xml version='1.0' encoding='UTF-8' ?>
      <aop>
          <aspect class="com.xxxx.report.util.ReportLimitHandler"/>
          <bind pointcut="execution(public java.lang.String com.xxxx.business.report.engine.ReportManagerBean->generateReport(com.xxxx.report.vo.ReportParameterVO, com.xxxx.parameters.DBParameters,  com.xxxx.parameters.LogParameters))">
              <around aspect="com.xxxx.report.util.ReportLimitHandler" name="tract"/>       
          </bind>
      </aop>

       

      #com.xxxx.business.report.engine.ReportManagerBean is class implement SessionBean

       

      -- Content of 'com.xxxx.report.util.ReportLimitHandler' --

      package com.xxxx.report.util;

       

      import org.jboss.aop.joinpoint.Invocation;

       

      public class ReportLimitHandler {

       

          public Object tract(Invocation invocation) throws Throwable {
              try{
                  System.out.println("Entering anything");
                  return invocation.invokeNext();
              }
              finally{
                  System.out.println("Leaving anything");
              }
          }
      }