[jboss-jira] [JBoss JIRA] Updated: (JBAS-4598) TimerHandle failed to retrieve timer after JBoss restart

Linoux Linoux (JIRA) jira-events at lists.jboss.org
Thu Aug 9 11:32:49 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBAS-4598?page=all ]

Linoux Linoux updated JBAS-4598:
--------------------------------

    Description: 
Creating a timer, store the associated TimerHandle in DB.
Restart JBoss server, try to get the Timer using the stored TimerHandle : javax.ejb.NoSuchObjectLocalException is thrown.

----------------------------------------------------------
//In a Stateless Session :

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void createTimer() throws OgpException {
    TimerService ts = ctx.getTimerService();
    Timer newTimer = ts.createTimer(getTimerStartDate(), DateUtil.MILLIS_IN_DAY, testAge);
    conf.setTestCleanTimerHandle(newTimer.getHandle());
    
    // Store conf in DB
}

private Timer getCurrentTimer(DbConfiguration conf) throws OgpException {
    if (conf.getTestCleanTimerHandle() == null)
      return null;
    try {
      return conf.getTestCleanTimerHandle().getTimer();
    } catch (NoSuchObjectLocalException e) {
        log.warn("Can't retrieve timer : it could be caused by the application redeployment", e);
       return null;
    }
}
----------------------------------------------------------

Using this code, call to getCurrentTimer after calling createTimer works fine, but after a JBoss restart, call to getCurrentTimer ends with a NoSuchObjectLocalException :

javax.ejb.NoSuchObjectLocalException: Timer not available: [target=jboss.j2ee:service=EJB3,ear=ogp-app.ear,jar=ogp-ejb.jar,name=AdminCleanDbSessionBean]
        at org.jboss.ejb.txtimer.TimerHandleImpl.getTimer(TimerHandleImpl.java:203)
        at com.sts.ogp.ejb.admin.AdminCleanDbSessionBean.getCurrentTimer(AdminCleanDbSessionBean.java:157)
        [...]

JBoss uses the PostgreSQL database to store the timers and all other stuff. I have noted that the timers.timerid field changed after restarting JBoss, that could explain why the Timer is not found by the TimerHandle...

  was:
Creating a timer, store the associated TimerHandle in DB.
Restart JBoss server, try to get the Timer using the stored TimerHandle : javax.ejb.NoSuchObjectLocalException is thrown.

----------------------------------------------------------
//In a Stateless Session :

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void createTimer() throws OgpException {
    TimerService ts = ctx.getTimerService();
    Timer newTimer = ts.createTimer(getTimerStartDate(), DateUtil.MILLIS_IN_DAY, testAge);
    conf.setTestCleanTimerHandle(newTimer.getHandle());
    
    // Store conf in DB
}

private Timer getCurrentTimer(DbConfiguration conf) throws OgpException {
    if (conf.getTestCleanTimerHandle() == null)
      return null;
    try {
      return conf.getTestCleanTimerHandle().getTimer();
    } catch (NoSuchObjectLocalException e) {
        log.warn("Can't retrieve timer : it could be caused by the application redeployment", e);
       return null;
    }
}
----------------------------------------------------------

Using this code, call to getCurrentTimer after calling createTimer works fine, but after a JBoss restart, call to getCurrentTimer ends with a NoSuchObjectLocalException :

javax.ejb.NoSuchObjectLocalException: Timer not available: [target=jboss.j2ee:service=EJB3,ear=ogp-app.ear,jar=ogp-ejb.jar,name=AdminCleanDbSessionBean]
        at org.jboss.ejb.txtimer.TimerHandleImpl.getTimer(TimerHandleImpl.java:203)
        at com.sts.ogp.ejb.admin.AdminCleanDbSessionBean.getCurrentTimer(AdminCleanDbSessionBean.java:157)
        [...]


> TimerHandle failed to retrieve timer after JBoss restart
> --------------------------------------------------------
>
>                 Key: JBAS-4598
>                 URL: http://jira.jboss.com/jira/browse/JBAS-4598
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: JBossAS-4.0.5.GA
>         Environment: Windows XP / PostgreSQL
>            Reporter: Linoux Linoux
>
> Creating a timer, store the associated TimerHandle in DB.
> Restart JBoss server, try to get the Timer using the stored TimerHandle : javax.ejb.NoSuchObjectLocalException is thrown.
> ----------------------------------------------------------
> //In a Stateless Session :
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> public void createTimer() throws OgpException {
>     TimerService ts = ctx.getTimerService();
>     Timer newTimer = ts.createTimer(getTimerStartDate(), DateUtil.MILLIS_IN_DAY, testAge);
>     conf.setTestCleanTimerHandle(newTimer.getHandle());
>     
>     // Store conf in DB
> }
> private Timer getCurrentTimer(DbConfiguration conf) throws OgpException {
>     if (conf.getTestCleanTimerHandle() == null)
>       return null;
>     try {
>       return conf.getTestCleanTimerHandle().getTimer();
>     } catch (NoSuchObjectLocalException e) {
>         log.warn("Can't retrieve timer : it could be caused by the application redeployment", e);
>        return null;
>     }
> }
> ----------------------------------------------------------
> Using this code, call to getCurrentTimer after calling createTimer works fine, but after a JBoss restart, call to getCurrentTimer ends with a NoSuchObjectLocalException :
> javax.ejb.NoSuchObjectLocalException: Timer not available: [target=jboss.j2ee:service=EJB3,ear=ogp-app.ear,jar=ogp-ejb.jar,name=AdminCleanDbSessionBean]
>         at org.jboss.ejb.txtimer.TimerHandleImpl.getTimer(TimerHandleImpl.java:203)
>         at com.sts.ogp.ejb.admin.AdminCleanDbSessionBean.getCurrentTimer(AdminCleanDbSessionBean.java:157)
>         [...]
> JBoss uses the PostgreSQL database to store the timers and all other stuff. I have noted that the timers.timerid field changed after restarting JBoss, that could explain why the Timer is not found by the TimerHandle...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list