<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    EJB3 @Scheduler Could not restore timer
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/avs.009">Allan Scheid</a> in <i>EJB3 Development</i> - <a href="https://community.jboss.org/message/739461#739461">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">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
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:126) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:263) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.SimpleDataInput.readUnsignedByte(SimpleDataInput.java:224) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:902) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1204) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) [jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:72) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;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]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;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]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;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]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;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]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.ejb3.timerservice.TimerServiceImpl.getActivePersistentTimers(TimerServiceImpl.java:893) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.ejb3.timerservice.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:633) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.ejb3.timerservice.TimerServiceImpl.start(TimerServiceImpl.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_01]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_01]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_01]
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My EJB code with scheduler is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>import</b></font> java.util.Calendar;
<font color="navy"><b>import</b></font> java.text.SimpleDateFormat;
<font color="navy"><b>import</b></font> javax.ejb.ConcurrencyManagement;
<font color="navy"><b>import</b></font> javax.ejb.ConcurrencyManagementType;
<font color="navy"><b>import</b></font> javax.ejb.Schedule;
<font color="navy"><b>import</b></font> javax.ejb.Singleton;
<font color="navy"><b>import</b></font> javax.ejb.Timer;
<font color="navy"><b>import</b></font> javax.inject.Inject;
<font color="navy"><b>import</b></font> org.jboss.logging.Logger;
&#160;
&#160;
&#160;
&#160;
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
<font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> MailMDB
<font color="navy">{</font>
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;@Inject
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy"><b>private</b></font> Logger log;
&#160;
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy"><b>private</b></font> <font color="navy"><b>void</b></font> printData(Object message)
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="navy"><b>if</b></font>(log !=<font color="navy"><b>null</b></font>)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;log.debug(message);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="navy"><b>else</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println(message);
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy">}</font>
&#160;
&#160;
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;@Schedule(hour=<font color="red">"*"</font>, minute=<font color="red">"*/5"</font>, persistent=<font color="navy"><b>true</b></font>)
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> backgroundProcessing(Timer timer) <font color="navy">{</font>
&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="navy"><b>final</b></font> SimpleDateFormat dtFormat = <font color="navy"><b>new</b></font> SimpleDateFormat(<font color="red">"dd/MM/yyyy HH:mm:ss"</font>);
&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Thread t = <font color="navy"><b>new</b></font> Thread(<font color="navy"><b>new</b></font> Runnable() <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printData(<font color="red">"Starting the thread: "</font> + Thread.currentThread().getName());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="darkgreen">//Do anything....</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printData(Thread.currentThread().getName() + <font color="red">" - Thread Stop in "</font> + dtFormat.format(Calendar.getInstance().getTime()));
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<font color="navy">}</font>);
&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;t.setPriority(Thread.NORM_PRIORITY);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;t.setName(<font color="red">"Thread - "</font> + dtFormat.format(Calendar.getInstance().getTime()));
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;t.start();
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<font color="navy">}</font>
<font color="navy">}</font>
&#160;
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Remember all, that's code are working, but i&#160; only recive error on start jboss.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks, Allan</p><p>Sorry for my English, i am Brazilian.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/739461#739461">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in EJB3 Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>