[jboss-user] [JBoss Seam] - Timer not starting from method with @Create annotation.
maniappan
do-not-reply at jboss.com
Fri Jun 8 05:38:25 EDT 2007
I try to start a timer with one minute interval using @Asynchronous annotation. when I schedule this timer from within any method in my application it seems to work properly. However when I try to invoke it from a @Create annotated method during startup the timer is not getting set, I see this error in the log.
| 2007-06-08 14:36:26,756 ERROR [org.jboss.ejb.txtimer.TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.NullPointerException:
| 2007-06-08 14:36:26,756 DEBUG [org.jboss.ejb.txtimer.TimerImpl] Timer was not registered with Tx, resetting state: [id=4,target=[target=jboss.j2ee:service=EJB3,ear=myapp.ear,jar=jboss-seam.jar,name=Dispatcher],remaining=-1048568,periode=60000,in_timeout]
|
Here is the code snippet where I invoke the timer..
| @Startup
| @Entity
| @Local
| @Table(name="myapp_schedule")
| @Stateful
| @Scope(ScopeType.APPLICATION)
| @Name("myappSchedule")
| public class MyappSchedule
| implements Serializable, MyappScheduleInterface
| {
| -- Setters/Getters for all fields in the table..
| @Create
| public void startScheduler() {
| log.info("Entering create now to start the schdeuler");
| try{Thread t = new Thread();
| t.sleep(10000);}
| catch(Exception e){}
| try {
| MyappScheduleController ysh = (MyappScheduleController) Component.getInstance("myappScheduleHome");
| ysh.saveAndSchedule();
| } catch (Exception e) {
| System.out.println("Got the exception while starting time "+e.toString());
| }
| }
|
| @Destroy @Remove
| public void dummy() {}
| }
|
When I invoke the saveAndSchedule() from any other method from application it works properly, not in the case above..
Any ideas on where could be the issue?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052463#4052463
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052463
More information about the jboss-user
mailing list