11 Replies Latest reply on Aug 17, 2005 10:23 AM by kabirkhan

    Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem

    christianbacher

      Hello,
      here is a checklist i have done to run the metrics aspect on a few
      classes deployed in jboss-4.03RC1, java 5.0 (build 1.5.0_01-b08, Linux),
      Jboss-AOP1.3.1 (jboss-aop-jdk50.deployer) after i read

      http://docs.jboss.com/aop/1.3/aspect-framework/reference/en/html/running.html#jboss
      http://www.jboss.org/index.html?module=bb&op=viewtopic&t=66619

      1. copied pluggable-instrumentor.jar to bin dir
      2. in run.sh added -javaagent:pluggable-instrumentor.jar
      3. in aop jboss-service.xml:
      set EnableLoadtimeWeaving to true
      added my packages (to instrument) to the Include entry
      set code attribute to AspectManagerServiceJDK5
      4. deployed an ear containing an .aop file with the bindings in the META-INF
      dir and the metrics aspect. the aop file is listed in the modules

      Observations:
      1. Nothing happens while calling the instrumented classes
      (no log messages from metric aspekt,
      which runs correct in standalone java mode)
      2. there are no error messages
      3. the aspects seem to be deployed correctly
      --> the bindings are listed in the jmx
      --> the aspect is listed in the jmx
      --> the properties of the mbean are ok.
      Here i wonder why there are no messages in log (even in debug mode)
      only the message from aopdeployer ( deployed file myaopfile.aop)

      Questions:
      --> what is to do now?
      --> Are there log messages when the classes are instrumented?
      --> Are there other steps to do?

      thanx for some hints and
      best regards,
      chrsitian

        • 1. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
          kabirkhan

          You can turn on verbose instrumentation by setting the Verbose attribute of the aspect manager service to true.

          If you haven't done so already, try to get the injboss tutorial example to work, the example is in jboss-aop/docs/aspect-framework/injboss. This should help uncover if you have missed out a step in setting up jboss or if there is a problem with your packaging.

          I don't think it is likely, but try replacing the Logger calls in your aspect with System.out.println to exclude any problems with logging.

          • 2. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
            christianbacher

            hello again,
            the injboss example does not work:
            14:32:46,283 INFO [STDOUT] **** ExampleValue empty Constructor
            14:32:46,284 INFO [STDOUT] **** ExampleValue.getMessage()
            14:32:49,426 INFO [STDOUT] **** EarExampleServlet.service()
            14:32:49,739 INFO [STDOUT] *** ExampleSessionBean.getValue()
            14:32:49,740 INFO [STDOUT] **** ExampleValue String Constructor
            14:32:49,741 INFO [STDOUT] **** ExampleValue String Constructor
            14:32:49,743 INFO [STDOUT] **** ExampleValue.getMessage()

            the interceptor messages are missing here.
            it was deployed directly via ant as ear + jboss-aop.xml

            by setting the verbose property to true,
            i found only the ejb3's in my ear beeing instrumented
            by the ejb3-interceptors-aop

            so obviously the problem is that the classes are not instrumented.

            best regards,
            christian

            • 3. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
              kabirkhan

              Since the injboss example is not working, you have missed out something for loadtime weaving. Can you post your jboss-aop-jdk50.deployer/META-INF/jboss-service.xml file, and the modified part of your run.sh?

              • 4. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                christianbacher

                hello,

                in run.sh changed

                JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME"

                to
                JAVA_OPTS="$JAVA_OPTS -Dprogram.name=$PROGNAME
                -javaagent:pluggable-instrumentor.jar"


                jboss-service.xml


                <?xml version="1.0" encoding="UTF-8"?>
                <!-- $Id: jboss-service.xml,v 1.6 2005/07/04 11:26:55 kkhan Exp $ -->
                
                <!-- ===================================================================== -->
                <!-- JBoss Server Configuration -->
                <!-- ===================================================================== -->
                
                <server>
                
                 <!-- The code for the service is different for the different run scenarios
                 *** JBoss 4.0
                 * JDK 1.4 - org.jboss.aop.deployment.AspectManagerService
                 * JDK 5 (not using -javaagent switch) - org.jboss.aop.deployment.AspectManagerService
                 * JDK 5 (using -javaagent switch) - org.jboss.aop.deployment.AspectManagerServiceJDK5
                 * BEA JRockit 1.4.2 - org.jboss.aop.deployment.AspectManagerService
                 *** JBoss 3.2
                 * JDK 1.4 - org.jboss.aop.deployment.AspectManagerService32
                 * JDK 5 (not using -javaagent switch) - org.jboss.aop.deployment.AspectManagerService32
                 * JDK 5 (using -javaagent switch) - org.jboss.aop.deployment.AspectManagerService32JDK5
                 * BEA JRockit 1.4.2 - org.jboss.aop.deployment.AspectManagerService32
                 -->
                 <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</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>

                best regards,
                christian


                • 5. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                  kabirkhan

                  That's strange. Nothing wrong sprang out at me, so I tried with your jboss-service.xml file and run.sh modifications and it worked just fine.

                  I tried both
                  $ant deploy-ear
                  $ant deploy-ear-aop

                  Are you sure you are modifying the jboss-service.xml under the right server configuration. e.g. if you are modifying JBOSS/server/all/deploy/jboss-aop-jdk50.deployer/META-INF/jboss-service.xml
                  you should start jboss with
                  $run -c all

                  • 6. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                    christianbacher

                    hello,
                    at the first time i have installed the all configuration with the jboss installer (because of ejb3 integration) which i called "default",
                    but i tested it later by unpacking the jboss-4.0.3RC1.tar.gz and configuring the installation for aop jdk50. Always the same result:
                    (Verbose is set to true)

                    JBoss Bootstrap Environment
                    
                     JBOSS_HOME: /root/jbossaop/jboss-4.0.3RC1
                    
                     JAVA: /usr/java/bin/java
                    
                     JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh -javaagent:pluggable-instrumentor.jar
                    
                     CLASSPATH: /root/jbossaop/jboss-4.0.3RC1/bin/run.jar:/usr/java/lib/tools.jar
                    
                    ........
                    12:09:05,377 INFO [AspectDeployer] Deployed AOP: file:/root/jbossaop/jboss-4.0.3RC1/server/all/deploy/jboss-aop.xml
                    ......
                    .......
                    12:10:17,505 INFO [EARDeployer] Init J2EE application: file:/root/jbossaop/jboss-4.0.3RC1/server/all/deploy/aopexample.ear
                    12:10:18,946 INFO [EjbModule] Deploying ExampleSession
                    12:10:19,395 INFO [EJBDeployer] Deployed: file:/root/jbossaop/jboss-4.0.3RC1/server/all/tmp/deploy/tmp22924aopexample.ear-contents/aopexampleejb.jar
                    12:10:19,516 INFO [TomcatDeployer] deploy, ctxPath=/aopexample, warUrl=file:/root/jbossaop/jboss-4.0.3RC1/server/all/tmp/deploy/tmp22924aopexample.ear-contents/aopexample.war/
                    12:10:19,902 INFO [EARDeployer] Started J2EE application: file:/root/jbossaop/jboss-4.0.3RC1/server/all/deploy/aopexample.ear
                    12:10:20,638 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
                    12:10:21,152 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
                    12:10:21,185 INFO [JkMain] Jk running ID=0 time=0/103 config=null
                    12:10:21,213 INFO [Server] JBoss (MX MicroKernel) [4.0.3RC1 (build: CVSTag=JBoss_4_0_3_RC1 date=200506260723)] Started in 1m:57s:782ms
                    12:10:47,491 INFO [STDOUT] **** ExampleValue empty Constructor
                    12:10:47,497 INFO [STDOUT] **** ExampleValue.getMessage()
                    12:10:51,548 INFO [STDOUT] **** EarExampleServlet.service()
                    12:10:51,714 INFO [STDOUT] *** ExampleSessionBean.getValue()
                    12:10:51,716 INFO [STDOUT] **** ExampleValue String Constructor
                    12:10:51,718 INFO [STDOUT] **** ExampleValue String Constructor
                    12:10:51,778 INFO [STDOUT] **** ExampleValue.getMessage()


                    Is it possible that there are OS - Specific issues?
                    (this installation is on a Gentoo Linux.)

                    best regards,
                    christian

                    • 7. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                      mlybarger

                      i don't suspect there to be an OS issue. i successfully run the aop examples (injbossaop) on gentoo using sun's jdk 1.5.0_04 (using both amd64, and amd xp-m arch).

                      out of curiousity, does your deploy folder have a jboss-aop.xml? i didn't notice anything in your server output that mentions that.

                      • 8. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                        christianbacher

                        hello,

                        sure, look at the log at 12:09:05,377

                        but the question is: what happens if it works

                        now the log says:
                        deployed jboss-aop.xml
                        then later the aopexample.ear is deployed
                        but then in verbose mode there have to be the
                        stdout debug statments of intrumenting classes.
                        but they are missing.
                        and there is no error message, (why?)

                        well i have also upgraded to java 5 update 4

                        best regards,
                        christian




                        • 9. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                          mlybarger

                          christian,

                          i noticed a few differences perhaps with what you're doing. you mention using ejb 3, i'm not there. you also mention using an ear, but i've used the injboss war.
                          i just tried a fresh clean install of jboss/jboss-aop on gentoo/jdk 1.5.0_04, and the injbossaop seems to be working fine. here's some steps i took to get up and running:

                          1. unzip jboss-4.0.2.tar.gz, and jboss-aop_1.3.1.zip

                          1.1 modify the startup script:

                          cd jboss-4.0.2/bin
                          echo "JAVA_OPTS=\"$JAVA_OPTS -javaagent:pluggable-instrumentor.jar\"" >> run.conf
                          


                          2. copy pluggable-instrumentor.jar to jboss/bin folder.
                          3 . copy in the jboss-aop-jdk50.deployer, remove the jboss-aop.deployer.

                          # update the jboss-sevice.xml
                          $ cd jboss-4.0.2/server/default/deploy/jboss-aop-jdk50.deployer/META-INF
                          $ cp jboss-service.xml HOLD-jboss-service.xml.HOLD
                          $ sed -i s/code=\"org.jboss.aop.deployment.AspectManagerService\"/code=\"org.jboss.aop.deployment.AspectManagerServiceJDK5\"/g jboss-service.xml
                          $ sed -i s/Weaving\"\>false/Weaving\"\>true/g jboss-service.xml
                          # build/deploy the aop example
                          $ cd ../../../../../../
                          $ cd jboss-aop_1.3.1/docs/aspect-framework/examples/injboss/
                          $ vim build.xml
                          $ ant deploy-basic-lt-war
                          


                          4. launch jboss via run.sh
                          5. wget http://localhost:8080/aopexample/

                          06:03:21,602 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
                          06:03:21,713 INFO [JkMain] Jk running ID=0 time=0/791 config=null
                          06:03:21,723 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 41s:562ms
                          06:04:03,965 INFO [STDOUT] <<< Entering SimpleInterceptor:
                           invocation class: org.jboss.injbossaop.lib.ExampleValue0OptimizedConstructorInvocation
                           type: Constructor Invocation
                           constructor: public org.jboss.injbossaop.lib.ExampleValue()
                          06:04:03,965 INFO [STDOUT] **** ExampleValue empty Constructor
                          06:04:03,965 INFO [STDOUT] >>> Leaving SimpleInterceptor
                          06:04:03,969 INFO [STDOUT] <<< Entering SimpleInterceptor:
                           invocation class: org.jboss.injbossaop.lib.ExampleValue$getMessage_5353407034680111516
                           type: Method Invocation
                           method: getMessage
                           Class containing method: org.jboss.injbossaop.lib.ExampleValue
                          06:04:03,970 INFO [STDOUT] **** ExampleValue.getMessage()
                          06:04:03,970 INFO [STDOUT] >>> Leaving SimpleInterceptor
                          



                          • 10. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                            christianbacher

                            hello,

                            ok, hmm, jboss 4.0.2 and ejb 3 do not work together properly.

                            so the question is:

                            do you have some roadmap when there is a 4.0.3 release
                            in which all components work together?

                            thank you for your help,
                            and best regards,
                            christian

                            • 11. Re: Again AOP1.3.1 Java 5.0 Jboss 4.0.3RC1 problem
                              kabirkhan