Results 1 to 4 of 4

Thread: AspectJ LTW does not work in Tomcat, but works fine in tcServer?!

  1. #1

    Unhappy SOLVED: AspectJ LTW does not work in Tomcat, but works fine in tcServer?!

    Hi all,

    I have been banging my head on a very heavy wall for the last couple of days.

    I am developing an application, which uses AspectJ Load-Time-Weaving (LTW). It works just fine on my locally installed tcServer (with the default "insight-instance" Tomcat server).

    However, when I deploy the application to a stock Tomcat 6.0.29 server, the AspectJ LTW is completely ignored.

    On both servers, I have copied "spring-instrument-tomcat-3.0.4.RELEASE.jar" to ./lib. Otherwise I haven't changed anything.

    I have made a test program, which I have attached.

    What am I missing? Can anybody get AspectJ to work on a Tomcat server at all?

    My best guess is that I am missing something crucial on the classpath. I just cannot figure out what...


    Please help!

    Best regards,
    ~Morten
    Attached Files Attached Files
    Last edited by silverjam; Dec 21st, 2010 at 12:51 AM.

  2. #2
    Join Date
    Dec 2010
    Posts
    1

    Default

    Have you added the TomcatInstrumentableClassLoader to the tomcat config? See

    http://static.springsource.org/sprin...w-environments

  3. #3

    Default

    I am pretty sure of this, since I get this in the log:

    Code:
    INFO: Using a reflective load-time weaver for class loader: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
    Here's the contents of $CATALINA_HOME/lib/:

    Code:
    work@poseidon ~/programs/apache-tomcat-6.0.29-new/lib $ ll
    total 4976
    drwxr-xr-x 2 work work    4096 16 dec 14:26 .
    drwxr-xr-x 9 work work    4096 16 dec 12:00 ..
    -rw-r--r-- 1 work work   15240 19 jul 14:59 annotations-api.jar
    -rw-r--r-- 1 work work   53752 19 jul 14:59 catalina-ant.jar
    -rw-r--r-- 1 work work  129627 19 jul 14:59 catalina-ha.jar
    -rw-r--r-- 1 work work 1191060 19 jul 14:59 catalina.jar
    -rw-r--r-- 1 work work  235004 19 jul 14:59 catalina-tribes.jar
    -rw-r--r-- 1 work work   32384 19 jul 14:59 el-api.jar
    -rw-r--r-- 1 work work  108570 19 jul 14:59 jasper-el.jar
    -rw-r--r-- 1 work work  525001 19 jul 14:59 jasper.jar
    -rw-r--r-- 1 work work 1407902 19 jul 14:59 jasper-jdt.jar
    -rw-r--r-- 1 work work   76693 19 jul 14:59 jsp-api.jar
    -rw-r--r-- 1 work work   88224 19 jul 14:59 servlet-api.jar
    -rw-r--r-- 1 work work    5724 16 dec 12:01 spring-instrument-tomcat-3.0.4.RELEASE.jar
    -rw-r--r-- 1 work work  758137 19 jul 14:59 tomcat-coyote.jar
    -rw-r--r-- 1 work work  249650 19 jul 14:59 tomcat-dbcp.jar
    -rw-r--r-- 1 work work   70035 19 jul 14:59 tomcat-i18n-es.jar
    -rw-r--r-- 1 work work   51966 19 jul 14:59 tomcat-i18n-fr.jar
    -rw-r--r-- 1 work work   55037 19 jul 14:59 tomcat-i18n-ja.jar
    
    work@poseidon ~/programs/apache-tomcat-6.0.29-new/lib $ unzip -v spring-instrument-tomcat-3.0.4.RELEASE.jar 
    Archive:  spring-instrument-tomcat-3.0.4.RELEASE.jar
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    --------  ------  ------- ---- ---------- ----- --------  ----
           0  Stored        0   0% 08-19-2010 11:33 00000000  META-INF/
         711  Defl:N      333  53% 08-19-2010 11:33 844bc811  META-INF/MANIFEST.MF
           0  Stored        0   0% 08-19-2010 11:33 00000000  org/
           0  Stored        0   0% 08-19-2010 11:33 00000000  org/springframework/
           0  Stored        0   0% 08-19-2010 11:33 00000000  org/springframework/instrument/
           0  Stored        0   0% 08-19-2010 11:33 00000000  org/springframework/instrument/classloading/
           0  Stored        0   0% 08-19-2010 11:33 00000000  org/springframework/instrument/classloading/tomcat/
        2423  Defl:N     1161  52% 08-19-2010 11:33 02035d69  org/springframework/instrument/classloading/WeavingTransformer.class
        4232  Defl:N     2069  51% 08-19-2010 11:33 a8a9495d  org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.class
         156  Defl:N      132  15% 08-19-2010 11:33 cb849bf4  org/springframework/instrument/classloading/tomcat/package-info.class
         124  Defl:N      102  18% 08-19-2010 11:33 b33c1032  overview.html
         230  Defl:N      113  51% 08-19-2010 11:33 3734ad74  META-INF/INDEX.LIST
    --------          -------  ---                            -------
        7876             3910  50%                            12 files
    If I modify the classname inside aop.xml, the server gets angry at me, so it seems that AspectJ has what it needs.....

    But it just doesn't work.... :-(

  4. #4

    Default Solved!

    It turned out that I was missing the ant-style syntax of the namespaces in aop.xml.

    However, tcServer behaves incorrectly then. Guess I'll file a bug on this...

    Cheers,
    ~Morten :-)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •