12 Replies Latest reply on Jul 7, 2005 11:13 PM by Scott Jones

    JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving = tru

    Scott Jones Newbie

      I must be missing something. I am trying to get Loadtime weaving working with JBoss 4.0.2 using jdk 1.4.2 and AOP 1.3

      I have set EnableLoadtimeWeaving = true but none of my aspects are being exectuted.

      Is there a step by step on how to get loadtime weaving working with the environment I listed above. Have not been able to find anything

        • 1. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
          Scott Jones Newbie

          More information,
          I had this working with JBoss 4.0.1 back in late Dec.
          when I was doing research.

          I am trying to working on adding this to our production branch.

          • 2. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
            Bill Burke Master

            Please re-read the documentation. You need to put the jdk14-pluggable-transformer.jar and also the generated jboss-classloader-transformer.jar in your bootclasspath. See section

            10.3.2 JBoss 4.x and JDK 1.4


            BTW, the reason we did this is because the old way was not reliable as it relied on a JBoss specific classloader. Tomcat and other applications use their own customer classloader in many situations which resulted in things like JSPs not getting aspectized.

            BTW, the old EnableTransformer switch still works. So, if you use EnableTransformer instead of EnableLoadtimeWeaving, you can still use the old way.

            • 3. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
              Scott Jones Newbie

              I do not know how I missed that. I will give it a try.
              Thanks

              • 4. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                Scott Jones Newbie

                I try to run create-pluggable-jboss-classloader.bat

                I get a memory could not be "written" when trying to run the line after
                rem Run instrumented program

                I click OK and it goes on a produces jboss-classloader-transformer.jar

                I have done the rest of the items in the doc and still do not get my aspect to run.

                Are there any class loading or packaging issues. My ejb is packaged in it's own jar and is in the deploy directory

                The jboss-aop.xml is in the deploy directory

                The aspects are packaged in a jar that is in the lib directory

                Scott

                • 5. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                  Scott Jones Newbie

                  That bat file line look like

                  %JAVA_CMD% -Xbootclasspath/p:%AOP_FILES% -classpath %USER_CLASSPATH% %AOPPATH% %AOPCLASSPATH% %MAINCLASS_AND_ARGS%


                  I can not find anything def on MAINCLASS_AND_ARGS

                  • 6. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                    Kabir Khan Master

                    It works fine for me. Don't worry too much about the contenys of create-pluggable-jboss-classloader.bat. It sounds like it is creating the file as expected

                    Did you do these steps from the docu:


                    This will create a jboss-classloader-transformer.jar. Copy this jar to the bin/ directory of your JBoss Application server distribution.

                    Next, you need to copy the jdk14-pluggable-instrumentor.jar from the lib/ directory of your JBoss AOP distribution to the bin/ directory of your JBoss application server installation. Next edit run.sh or run.bat (depending on what OS you're on) and add the following to the JAVA_OPTS environment variable

                    JAVA_OPTS="$JAVA_OPTS -Dprogram.name=%PROGNAME% -Xbootclasspath/p:jboss-classloader-transformer.jar:jdk14-pluggable-instrumentor.jar"
                    
                    


                    After modifying JAVA_OPTS and setting the EnableLoadtimeWeaving to true, then you should be ready to go.


                    • 7. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                      Scott Jones Newbie

                      I have add those items to java_opts and added the jars to the bin directory and EnableLoadtimeWeaving=true. And still not executed my aspects.

                      I am working on the examples under injboss and not getting the aspects execute. So there is something miss alined.

                      
                      ===============================================================================
                      .
                       JBoss Bootstrap Environment
                      .
                       JBOSS_HOME: C:\jboss-4.0.2\bin\\..
                      .
                       JAVA: C:\j2sdk1.4.2_06\bin\java
                      .
                       JAVA_OPTS: -Dprogram.name=run.bat -Xbootclasspath/p:jboss-classloader-transformer.jar:jdk14-pluggable-instrumentor.jar -Xms128m -Xmx512m
                      .
                       CLASSPATH: C:\j2sdk1.4.2_06\lib\tools.jar;C:\jboss-4.0.2\bin\\run.jar
                      .
                      ===============================================================================
                      .
                      16:27:24,056 INFO [Server] Starting JBoss (MX MicroKernel)...
                      16:27:24,056 INFO [Server] Release ID: JBoss [Zion] 4.0.2 (build: CVSTag=JBoss_
                      


                      • 8. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                        Kabir Khan Master

                        Make sure that you add org.jboss.injbossaop to the "Include" attribute of the aspect manager service. Otherwise they get excluded by the org.jboss value put into the Exclude attribute. Entries are comma separated.

                        I have enabled this example by default in 1.3.1

                        • 9. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                          Scott Jones Newbie

                          Done that. My file looks like

                          <?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">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">false</attribute>
                           </mbean>
                          
                           <mbean code="org.jboss.aop.deployment.AspectDeployer"
                           name="jboss.aop:service=AspectDeployer">
                           </mbean>
                          
                          </server>
                          


                          • 10. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                            Bill Burke Master

                            there is a typo in your "Include" attribute. Do you see it?

                            • 11. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                              Scott Jones Newbie

                              no. The only thing I see that I try changing is the . at the end of injbossaop

                              I tried both

                              <attribute name="Include">org.jboss.test,org.jboss.injbossaop.</attribute>


                              • 12. Re: JBoss 4.0.2, JDK 1.4.2, AOP 1.3, EnableLoadtimeWeaving =
                                Scott Jones Newbie

                                OK I got my head out of my

                                The issue was the bat file.

                                I pasted the line directly from the tutorial as

                                JAVA_OPTS="$JAVA_OPTS -Dprogram.name=%PROGNAME% -Xbootclasspath/p:jboss-classloader-transformer.jar:jdk14-pluggable-instrumentor.jar"
                                


                                I needed to change the : between the two jars to a ;

                                JAVA_OPTS="$JAVA_OPTS -Dprogram.name=%PROGNAME% -Xbootclasspath/p:jboss-classloader-transformer.jar;jdk14-pluggable-instrumentor.jar"
                                


                                I change the other things to make it dos base but not that

                                Thanks again for your help. I have the injboss examples working and I have my old examples working again