JBoss Community

EJB3 @Scheduler Could not restore timer

created by Allan Scheid in EJB3 Development - View the full discussion

Hello all,

 

I did a ejb with scheduler annotation, and then is working correctly, but every jboss as 7.1.1 final start i receive this error:

 

23:20:47,994 ERROR [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014129: Could not restore timer from C:\jboss-as-7.1.1.Final\standalone\data\timer-service-data\PortalAmil-EAR.PortalAmil-EJB.MailMDB\59970b97-5d5e-44ef-9700-8e7c826929e4: java.io.EOFException: Read past end of file
          at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:126) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:263) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.SimpleDataInput.readUnsignedByte(SimpleDataInput.java:224) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:902) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1204) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:72) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
          at org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence.loadTimersFromFile(FileTimerPersistence.java:319) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence.getTimers(FileTimerPersistence.java:296) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence.loadActiveTimers(FileTimerPersistence.java:236) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence.loadActiveTimers(FileTimerPersistence.java:253) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.TimerServiceImpl.getActivePersistentTimers(TimerServiceImpl.java:893) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:633) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.ejb3.timerservice.TimerServiceImpl.start(TimerServiceImpl.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_01]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_01]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_01]

 

My EJB code with scheduler is:

 

 

import java.util.Calendar;
import java.text.SimpleDateFormat;
import javax.ejb.ConcurrencyManagement;
import javax.ejb.ConcurrencyManagementType;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Timer;
import javax.inject.Inject;
import org.jboss.logging.Logger;
 
 
 
 
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class MailMDB
{
          @Inject
          private Logger log;
 
          private void printData(Object message)
          {
                    if(log !=null)
                              log.debug(message);
                    else
                              System.out.println(message);
          }
 
 
          @Schedule(hour="*", minute="*/5", persistent=true)
          public void backgroundProcessing(Timer timer) {
  
                    final SimpleDateFormat dtFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
  
                    Thread t = new Thread(new Runnable() {
                              printData("Starting the thread: " + Thread.currentThread().getName());
                              //Do anything....
                              printData(Thread.currentThread().getName() + " - Thread Stop in " + dtFormat.format(Calendar.getInstance().getTime()));
                    });
  
                    t.setPriority(Thread.NORM_PRIORITY);
                    t.setName("Thread - " + dtFormat.format(Calendar.getInstance().getTime()));
                    t.start();
          }
}
 

 

Remember all, that's code are working, but i  only recive error on start jboss.

 

Thanks, Allan

Sorry for my English, i am Brazilian.

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community