Results 1 to 3 of 3

Thread: Task annotaion doesnt work with context:load-time-weaver aspectj-weaving="on" - BUG ?

  1. #1
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default Task annotaion doesnt work with context:load-time-weaver aspectj-weaving="on" - BUG ?

    Hi I have the following entries in my application context xml
    Code:
    <task:annotation-driven scheduler="mySchedulor"/>
    
    <task:scheduler id="mySchedulor"/>
    
    <bean id="timer" class="com.pg.Timer"/>
    
    public class Timer{
    
    @Scheduled(fixedDelay=5000)
    public void run() {
    
    System.out.println("calling dummy");
    
    }
    
    }
    This works fine as expected , but when i add

    Code:
    <context:load-time-weaver aspectj-weaving="on" />
    This doesnt work, that is my run() method doesnt get called every 5 seconds.

    I initially thought this could be issue with spring 3 and posted it in the forum
    http://forum.springsource.org/showthread.php?t=82321


    But later it seems that this code works fine independently , but under spring Dm 2.0 RC1 , this doesnt work :-(

    I also dont get any errors , but my task doesn't get called

    could this be a BUG ?

  2. #2
    Join Date
    Oct 2008
    Posts
    493

    Default

    I've tried to reproduce the problem, but have been unable to do so, i.e. the scheduler works fine, and run() is called even with load-time weaving enabled.

    One thing to be aware of: when AspectJ load-time weaving is enabled you will have to import the org.aspectj.lang package. My manifest for the bundle is as follows:

    Code:
    Manifest-Version: 1.0
    Bundle-Name: Test
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: test
    Bundle-Version: 1.5.0
    Import-Library: org.springframework.spring
    Import-Package: org.aspectj.lang
    The application context definition and the Timer class are as you posted above.
    Andy Wilkinson
    SpringSource

  3. #3
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    Thanks Andy.

    I did figure out that the problem was in my manifest.

    A class not found exception in the above scenario would be very helpfull, else everything looks magical.

Posting Permissions

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