users@glassfish.java.net

Re: IllegalArgumentException: "timers" / OldTypesBase.oldObjectNameToJ2EEType

From: jsexton0 <jsexton0_at_gmail.com>
Date: Mon, 10 Nov 2008 15:01:37 -0800 (PST)

Today I tried a trivial timed object, that never fires. I also get this very
error (java.lang.IllegalArgumentException: "timers")
Any ideas anyone?
Here's a trivial timer, which does not work:

import java.util.Date;
import java.util.logging.Logger;
import javax.ejb.Timer;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.TimedObject;
import javax.ejb.TimerHandle;
import javax.ejb.TimerService;

@Stateless
public class CMSTimerBean implements TimedObject {
    private SessionContext sc;
    private TimerHandle timerHandle = null;

    public void ejbTimeout(javax.ejb.Timer arg0) {
        java.util.logging.Logger.getLogger(getClass().getName()).log(
                java.util.logging.Level.INFO,
                "Tick");
    }

    public void ejbPostCreate() {
        Date now = new Date();
        initializeTimer(now, 30000, "CMS_TIMER");
    }

    public void initializeTimer(Date firstDate, long timeout, String
timerName) {
        try {
            TimerService ts = sc.getTimerService();
            Timer timer = ts.createTimer(firstDate, timeout, timerName);
            timerHandle = timer.getHandle();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setSessionContext(SessionContext ctx) {
      sc = ctx;
    }

}

-- 
View this message in context: http://www.nabble.com/IllegalArgumentException%3A-%22timers%22---OldTypesBase.oldObjectNameToJ2EEType-tp19918950p20429896.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.