JBoss Community

Adding @Schedule annotation using AOP is not working

created by Eman Emanovic in EJB3 - View the full discussion

Hi,

 

I already asked this question on AOP forum (http://community.jboss.org/message/623183#623183). But I am not sure if it is AOP or EJB problem, so I copy it here as well.

 

I am trying to create schedule event using EJB3.1 @Schedule annotation. Everything works fine as long as I have the annotation inside my bean. I want to be able to change schedule in deployment time without repacking ear. So I want to add this annotation using AOP. But it doesn't work.

 

Here is my sample bean:

 

@AspectDomain(value = "TimerBeanDomain")

@Singleton

public class TimerBean {


      public void timerMethod() {  

         System.out.println("Timer method activated");

      }

}

 

 

 

And here is my aop.xml:

 

<?xml version="1.0" encoding="UTF-8"?>


<aop xmlns="urn:jboss:aop-beans:1.0">

     <domain name="TimerBeanDomain"> 

         <annotation expr="method(void *->timerMethod(..))>  

             @javax.ejb.Schedule(second=*/30, minute=*, hour=*") 

         </annotation> 

    </domain>

</aop>

 

 

 

 

Bean is packed inside -ejb.jar, which is packed in .ear. AOP file is outside ear file.

 

There are no errors in console. It just does not work.

 

I tried it with stateless bean as well. In this case aop.xml looked like:

<domain name="TimerBeanDomain" extends="Stateless Bean" inheritBindings="true"> 

 

I tried JBoss 6.0.1 and JBoss 6.1.0 with same result.

 

At least is there some way how to debug AOP process of adding annotation?

 

Any help will be appreciated.

 

Regards,

Eman

Reply to this message by going to Community

Start a new discussion in EJB3 at Community