0 Replies Latest reply on Oct 30, 2006 10:26 AM by mlsreekanth

    Error while timeout handler is executed

    mlsreekanth Newbie

      Hi all,

      Environment : Windows XP with java1.6 beta and Jboss 4.0.4GA

      I am using Container managed Persistence context (EJB3 entity manager)

      I have a problem with a timer. It is being created properly with a warning

      20:53:13,343 WARN [TxConnectionManager] Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.

      Time out handler also called properly. At the end of the method it is raising one error and whole transaction is rolled back.


      20:55:00,234 ERROR [TimerImpl] Error invoking ejbTimeout: java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=lakssrikd/50, BranchQual=, localId=50] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.NullPointerException)

      There is no other trace is available for htis error.

      Please help me to resolve the issue.

      Timer Code:

      import java.util.Collection;
      import java.util.Date;
      import java.util.Iterator;

      import javax.annotation.Resource;
      import javax.annotation.security.PermitAll;
      import javax.ejb.Local;
      import javax.ejb.SessionContext;
      import javax.ejb.Stateless;
      import javax.ejb.Timeout;
      import javax.ejb.Timer;
      import javax.interceptor.Interceptors;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;

      import org.jboss.seam.Component;
      import org.jboss.seam.annotations.Intercept;
      import org.jboss.seam.annotations.Name;

      public class TenderUnlockTimerAction implements TenderUnlockTimer {

      private SessionContext ctx;

      EntityManager entityManager;

      public void scheduleTimer(long milliseconds, String nitId) {

      new Date(new Date().getTime() + milliseconds), nitId);

      public void timeoutHandler(Timer timer) {

      String processName = "process_name"; // masked
      String id= timer.getInfo().toString();
      ProcessHelper processHelper = (ProcessHelper) Component
      String processId = processHelper.startEvaluationProcess(processName,
      // Chnage the status of the entity using EM
      // After this statement it is raising the error .. found while debugging
      }catch(Exception e){


      public void scheduleTimer(String nitId, Date unlockingDate) {
      // Create UnlockTimer for the task "taskName"
      try {
      if (ctx != null) {
      if (ctx.getTimerService() != null) {
      ctx.getTimerService().createTimer(unlockingDate, nitId);
      System.out.println("Timer service is null");
      System.out.println(" Session context is null");
      } catch (Exception e) {

      public void cancelTimerByName(String name) {
      // Cancel the timer by name
      if (name != null) {
      Collection timers = ctx.getTimerService().getTimers();
      Timer timer = null;
      if (!timers.isEmpty()) {
      Iterator timersIterator = timers.iterator();
      while (timersIterator.hasNext()) {
      timer = (Timer) timersIterator.next();
      System.out.println(" Timer name " + timer.getInfo());
      if (timer.getInfo().toString().trim().equals(name.trim())) {
      System.out.println(" Canceling the Timer with name " + timer.getInfo());
      System.out.println(" There are no timer defined ");
      } else {
      // If name is null throw runtime exception
      throw new ApplicationDefaultException(

      public void scheduleTimer(long milliseconds) {
      // TODO Auto-generated method stub


      public void rescheduleTimer(String name, Date newDate) {
      scheduleTimer(name, newDate);