users@glassfish.java.net

Re: IllegalArgumentException: "timers" / OldTypesBase.oldObjectNameToJ2EEType

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 10 Nov 2008 15:07:55 -0800

Can you post the complete stack trace and GF version?

thanks,
-marina

jsexton0 wrote:
> 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;
> }
>
> }
>