0 Replies Latest reply: Aug 26, 2011 8:48 AM by emanovic RSS

Adding @Schedule annotation using AOP is not working

emanovic Newbie



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. Because I want to be able to change schedule in deploy 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")
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="*")


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.