8 Replies Latest reply on Jul 7, 2005 5:10 PM by Kabir Khan

    Problem with aop 1.3

    Andrew Rosenberg Newbie

      Everything seems to be good...my -aop.xml file is getting deployed:

      11:05:28,600 [-10.0.0.220] INFO yment.AspectDeployer - Deployed AOP: file:/C:/apps/jboss-4.0.1sp1/server/marble/tmp/deploy/tmp14669Marble.ear-contents/annotations.aop
      

      I put a breakpoint on AspectXmlDeployer.deployXML and my xml file is getting deployed.
      BUT when I run my app, none of my aspects work. No method/field interceptors get called.
      I just upgraded to aop 1.3 jdk5 on 4.0.1sp1

      Any ideas what could be going wrong? What should I be looking for?
      That's the only line in the log that I see from aop during my app deployment.
      The only thing I did was to copy the jboss-aop-jdk5.deployer to my server/app/deploy/ directory. Is there something else I need to do?

        • 1. Re: Problem with aop 1.3
          Andrew Rosenberg Newbie

          Here's my jboss-service.xml file:

          <?xml version="1.0" encoding="UTF-8"?>
          <!-- $Id: jboss-service.xml,v 1.3.2.3 2005/06/19 07:08:07 bill Exp $ -->
          
          <!-- ===================================================================== -->
          <!-- JBoss Server Configuration -->
          <!-- ===================================================================== -->
          
          <server>
          
           <mbean code="org.jboss.aop.deployment.AspectManagerService"
           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">false</attribute>
           <attribute name="Prune">true</attribute>
           <attribute name="Include">org.jboss.test</attribute>
           <attribute name="Exclude">org.jboss.</attribute>
           <attribute name="Optimized">true</attribute>
           <attribute name="Verbose">true</attribute>
           </mbean>
          
           <mbean code="org.jboss.aop.deployment.AspectDeployer"
           name="jboss.aop:service=AspectDeployer">
           </mbean>
          
          </server>
          


          • 2. Re: Problem with aop 1.3
            Bill Burke Master

            did you set up the pluggable-instrumentor.jar? Doco has more info.

            • 3. Re: Problem with aop 1.3
              Andrew Rosenberg Newbie

              I put it in the /bin directory (JBOSS_HOME/bin)

              Here is the output of run.bat:

              JBoss Bootstrap Environment
              .
               JBOSS_HOME: C:\apps\jboss-4.0.1sp1\bin\\..
              .
               JAVA: C:\Program Files\Java\jdk1.5.0_01\bin\java
              .
               JAVA_OPTS: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=iapetus:39294,suspend=y,server=n -Dmms.core.config=C:\projects\6\marble\source\config\test-harness -Dprogram.name=run.bat -javaagent:pluggable-instrumentor.jar -Xms128m -Xmx512m
              .
               CLASSPATH: C:\Program Files\Java\jdk1.5.0_01\lib\tools.jar;C:\apps\jboss-4.0.1sp1\bin\\run.jar
              .


              • 4. Re: Problem with aop 1.3
                Kabir Khan Master

                To use the -javaagent switch, you must use AspectManagerServiceJDK5 as the code for the service.

                • 5. Re: Problem with aop 1.3
                  Andrew Rosenberg Newbie

                  That did it! :)

                  I didn't see that in the docs anywhere.
                  Also in the jboss-service.xml in the jboss-aop_1.3\jboss-40-install\jboss-aop-jdk50.deployer\META-INF directory it's listed as code="org.jboss.aop.deployment.AspectManagerService"

                  Maybe I just missed the doc somehow.

                  • 6. Re: Problem with aop 1.3
                    Kabir Khan Master

                    It will be in the docs for 1.3.1, along with some more aggressive comments in jboss-service.xml

                    • 7. Re: Problem with aop 1.3
                      Robert Schwegler Newbie

                      It took me many many hours and finally here is the right hint! I'm using JDK5, aop1.3 and 4.0.3RC1.

                      Now as I'm using AspectManagerServiceJDK50, I see much more information in the log, but I'm looking for an example with the JBoss Server. Are there any tricks with the class-loader? I wrote an XMBean and deployed it in a sar-directory:

                      package xmbeanprimer;
                      import xmbeanprimer.Traceable;
                      import xmbeanprimer.Billable;
                      public class Greeter {
                       private int greetingsSent = 0;
                       @Billable
                       public String hello() {
                       this.setGreetingsSent(this.greetingsSent+1);
                       return "Hello World (" + this.greetingsSent + ")!";
                       }
                       public int getGreetingsSent() {
                       return this.greetingsSent;
                       }
                       public void setGreetingsSent(int c) {
                       this.greetingsSent = c;
                       }
                      }


                      I wrote an aspect and put it in a jar called: adp.aop with an advice:
                      ...
                       @Bind (pointcut="execution(java.lang.String xmbeanprimer.Greeter->@Billable(
                      ))")
                       public Object methodAdvice(MethodInvocation invocation) throws Throwable {
                      ...


                      My BillingAdvice got deployed:
                      22:47:52,119 INFO [STDOUT] [debug] Looking for aspects in: adp.BillingAdvice
                      22:47:52,139 INFO [STDOUT] [debug] Found @Aspect in: adp.BillingAdvice
                      22:47:52,249 INFO [STDOUT] [trying to transform] $Proxy54
                      22:47:52,249 INFO [STDOUT] [debug] There are no caller pointcuts!
                      22:47:52,259 INFO [STDOUT] [debug] was $Proxy54 converted: false
                      22:47:52,419 INFO [STDOUT] [trying to transform] $Proxy55
                      22:47:52,419 INFO [STDOUT] [debug] There are no caller pointcuts!
                      22:47:52,429 INFO [STDOUT] [debug] was $Proxy55 converted: false
                      22:47:52,549 INFO [AspectDeployer] Deployed AOP: file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/deploy/adp.aop


                      But my Advice is not found:
                      22:47:54,913 INFO [STDOUT] method matched binding execution(* *->@xmbeanprimer.Billable(..)) public java.lang.String xmbeanprimer.Greeter.hello()
                      22:47:54,913 INFO [STDOUT] [debug] added advisor: xmbeanprimer.Greeter from binding: jar:file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/tmp/deploy/tmp51167adp.aop!/META-INF/jboss-aop.xml0
                      22:47:54,993 ERROR [MainDeployer] Could not create deployment: file:/D:/bin/jboss/jboss-4.0.3RC1/server/default/deploy/greeter01.sar/
                      org.jboss.deployment.DeploymentException: java.lang.ClassNotFoundException: No ClassLoaders found for: adp.BillableInterceptor; - nested throwable: (java.lang.RuntimeException: java.lang.ClassNotFoundException: No ClassLoaders found for: adp.BillableInterceptor)


                      Thanks for any hints how to package it cleanly. My target is to do runtime weaving! I checked the examples but all of them compile all the files in one directory. Have I overseen an example?

                      Regards
                      Robert Schwegler, Amadeus

                      • 8. Re: Problem with aop 1.3
                        Kabir Khan Master

                        There is an example called "injboss" which does loadtime weaving in jboss.

                        Make sure that you add org.jboss.injbossaop to the "Include" attribute of the aspect manager service