2 Replies Latest reply on Mar 30, 2009 5:29 AM by kabirkhan

    Problem intercepting DataSource method calls in JBoss 4

    fbrueseke

      Hi JBoss AOP folks.

      I have been fiddling with JBoss AOP all day now and just can't find the right solution. I want to use AOP to monitor which data sources are there and how long acquiring connections takes.

      I am using a -aop.xml configuration file in my deploy directory. The bindings are the following:

      <bind pointcut="construction(org.jboss.resource.adapter.jdbc.WrapperDataSource->new(..))">
       <interceptor class="my.interceptors.aop.DatasourceRegistrar"/>
       </bind>
      
       <bind pointcut="execution(public java.sql.Connection org.jboss.resource.adapter.jdbc.WrapperDataSource->getConnection(..))">
       <interceptor class="my.interceptors.aop.DatasourceConnectionInterceptor"/>
       </bind>


      I use JBoss AOP version 1.5.6 with "javaagent" and load-time weaving. My configuration file is the following:
      <mbean code="org.jboss.aop.deployment.AspectManagerServiceJDK5"
       name="jboss.aop:service=AspectManager">
       <attribute name="EnableLoadtimeWeaving">true</attribute>
       <!-- only relevant when EnableLoadtimeWeaving is true.
       When transformer is on, every loaded class gets
       transformed. If AOP can't find the class, then it
       throws an exception. Sometimes, classes may not have
       all the classes they reference. So, the Suppressing
       is needed. (i.e. Jboss cache in the default configuration -->
       <attribute name="SuppressTransformationErrors">true</attribute>
       <attribute name="Prune">true</attribute>
       <attribute name="Include">org.jboss.test, org.jboss.injbossaop, org.jboss.resource</attribute>
       <attribute name="Exclude">org.jboss.</attribute>
       <!-- This avoids instrumentation of hibernate cglib enhanced proxies
       <attribute name="Ignore">*$$EnhancerByCGLIB$$*</attribute> -->
       <attribute name="Optimized">true</attribute>
       <attribute name="Verbose">false</attribute>
       </mbean>


      The interceptors should print out some log messages. But it just doesn't happen anything.
      Does anybody know why?

      Please help.
      Kind regards
      Frank