Aspectj 1.5 - Preparing Sun 1.4 JVMs

AspectJ5 does not directly support load time weaving on Sun 1.4 VM. Hence the bootclasspath needs to be modified with an enhanced classloader implementation. This involves two steps:

  1. Prepare the enhanced classloader

    InfraRED ships with an aspectwerkz-core-2.0.jar. Using that file, run the following commands:

    > set CLASSPATH=%INFRARED_HOME%\aspectwerkz-core-2.0.jar;%JAVA_HOME%\lib\tools.jar
    > java org.codehaus.aspectwerkz.hook.Plug -target %INFRARED_HOME%\enhanced.jar          
                            

    This creates a file enhanced.jar in INFRARED_HOME. (AspectWerkz documentation refers to this as 'Prepared bootclasspath').

  2. Setting up the bootclasspath

    Prepend enhanced.jar created above to the bootclasspath, append infrared-aspectsystem-all-2.4.1.BETA.jar to the bootclasspath, and add infrared jars to the classpath. The following section describes this for Weblogic, Tomcat and JBoss servers.

    • Weblogic:

      You need to edit the DOMAIN_HOME\startWeblogic.cmd(sh) or DOMAIN_HOME\startManagedWeblogic.cmd(sh) file to add:

                
      @REM Integrate InfraRED with Weblogic running on Sun 1.3/4 JVM
      set JAVA_OPTIONS=-Xbootclasspath/p:%INFRARED_HOME%\enhanced.jar -Xbootclasspath/a:%INFRARED_HOME%\infrared-aspectsystem-all-2.4.1.BETA.jar -Daspectwerkz.classloader.preprocessor=net.sf.infrared.weaverhook.ClassPreProcessorAdaptor %JAVA_OPTIONS%
      set CLASSPATH=%INFRARED_HOME%\infrared-agent-all-weblogic-2.4.1.BETA.jar;%CLASSPATH%        
                                      

      You can add these lines anywhere in the file before the command to launch the VM.

    • Tomcat:

      You need to:

      • edit the TOMCAT_HOME\bin\setclasspath.bat(sh) to add:

        @REM Integrate InfraRED with Tomcat running on Sun 1.3/4 JVM
        set JAVA_OPTS=-Xbootclasspath/p:%INFRARED_HOME%\enhanced.jar -Xbootclasspath/a:%INFRARED_HOME%\infrared-aspectsystem-all-2.4.1.BETA.jar -Daspectwerkz.classloader.preprocessor=net.sf.infrared.weaverhook.ClassPreProcessorAdaptor%JAVA_OPTS%   
                                                

        You can add these lines anywhere in the file.

      • copy the infrared-agent-all-servlet-2.4.1.BETA.jar into TOMCAT_HOME\common\lib directory.
    • JBoss:

      You need to:

      • edit the JBOSS_HOME\run.bat(sh) to add:

        @REM Integrate InfraRED with JBoss running on Sun 1.3/4 JVM
        set JAVA_OPTS=-Xbootclasspath/p:%INFRARED_HOME%\enhanced.jar -Xbootclasspath/a:%INFRARED_HOME%\infrared-aspectsystem-all-2.4.1.BETA.jar 
        -Daspectwerkz.classloader.preprocessor=net.sf.infrared.weaverhook.ClassPreProcessorAdaptor %JAVA_OPTS%   
                                                

        You can add these lines anywhere in the file before the command to launch the VM.

      • copy the file INFRARED_HOME\infrared-agent-all-jboss-2.4.1.BETA.jar into JBOSS_HOME\server\default\lib directory.