Results 1 to 5 of 5

Thread: Load Time Weaving in Jetty

  1. #1

    Default Load Time Weaving in Jetty

    According to the new Spring 2.5 docs, the preferred way is to wire in AspectJ with Load Time Weaving is through the spring-agent.jar Java agent option (it used to be aspectj-agent.jar in Spring 2.0 I think).

    Running tests etc. through the command line works when I load the spring-agent.jar, but running in Jetty fails. Status messages says AspectJ is loaded, and the configuration files are read. But there is no weaving going on. When I use the aspectj-agent.jar it loads, and this time weaving is performed.

    I suspect this has something to do with classloading in Jetty, since the weave is done through load time and classloading. Does anyone with any insight to the classloading have a solution for this? I can probably use the aspectj agent for now, but I prefer to use the Spring documented way.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    Make sure that there is only one spring-agent.jar on your jetty classpath, don't include it on your application but only on the server classpath.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    And now I see there is an approval process. Sorry for the double posting. And this just went through without approval. Might be the link I pasted, the posts will hopefully be approved soon.

  4. #4

    Default

    Hjm, my replies doesn't seem to come through.

    On the Jetty server nothing gets weaved with the spring-agent.jar, but it runs fine in the tests. The tests run really slow (loading the spring context takes ages) with aspejct-weaver.jar, but at least it weaves in Jetty.

    I found a thread on the Jetty list describing others having problems with spring-agent.jar, and using aspectj-weaver instead. I tried pasting the link in previous posts, but think that's why they ended up in moderation, and is not shown here. Search Google for "aspectj jetty spring-agent" to find it.

    Any hints on how to debug etc. would be most welcome.

    Anders,

  5. #5

    Default

    When I enable logging I see that AspectJ loads:

    Code:
    [AspectJ Weaver] (main:) [AspectJ] AspectJ Weaver Version 1.6.0 built on Wednesday Apr 23, 2008 at 20:27:36 GMT                                                                                                                                                                                                     
    [AspectJ Weaver] (main:) [AspectJ] register classloader org.mortbay.jetty.webapp.WebAppClassLoader@1ad093c                                                                                                                                                                                                          
    [AspectJ Weaver] (main:) [AspectJ] using configuration /C:/workspace/source/trunk/server/target/classes/META-INF/aop.xml                                                                                                                                                                           
    [AspectJ Weaver] (main:) [AspectJ] using configuration file:/C:/Documents%20and%20Settings/asv/.m2/repository/efaktura-faktura-register-app/3.0.20/efaktura-faktura-register-app-3.0.20.jar!/META-INF/aop.xml                                                                           
    [AspectJ Weaver] (main:) [AspectJ] using configuration file:/C:/Documents%20and%20Settings/asv/.m2/repository/org/springframework/spring-aspects/2.5.4/spring-aspects-2.5.4.jar!/META-INF/aop.xml                                                                                                                   
    [AspectJ Weaver] (main:) [AspectJ] using configuration /C:/workspace/source/trunk/processor-web/target/classes/META-INF/aop.xml                                                                                                                                                            
    [AspectJ Weaver] (main:) [AspectJ] using configuration /C:/workspace/source/trunk/domain/target/classes/META-INF/aop.xml                                                                                                                                                                           
    [AspectJ Weaver] (main:) [AspectJ] using configuration /C:/workspace/source/trunk/processor/target/classes/META-INF/aop.xml                                                                                                                                                                
    [AspectJ Weaver] (main:) [AspectJ] using configuration /C:/workspace/source/trunk/overvaakning-uttrekk/target/classes/META-INF/aop.xml                                                                                                                                                             
    [AspectJ Weaver] (main:) [AspectJ] register aspect org.springframework.transaction.aspectj.AnnotationTransactionAspect                                                                                                                                                                                              
    [AspectJ Weaver] (main:) [AspectJ] not weaving '$Proxy1'                                                                                                                                                                                                                                                            
    [AspectJ Weaver] (main:) [AspectJ] not weaving '$Proxy7'                                                                                                                                                                                                                                                            
    [AspectJ Weaver] (timer-OvUt:) [AspectJ] not weaving '$Proxy8'                                                                                                                                                                                                                                                      
    [AspectJ Weaver] (main:) [AspectJ] not weaving '$Proxy9'                                                                                                                                                                                                                                                            
    [AspectJ Weaver] (main:) [AspectJ] not weaving '$Proxy10'
    The Not weaving messages makes sense as I still have some proxies in my context, but there's no messages about weaving anything. When I remove the proxy around the classes I want weaved I get less "not weaving proxy" messages, so I am pretty certain it scans the beans I want it to scan.

Posting Permissions

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