You can only @Inject tapestry services into other tapestry controlled objects. Your timer task isn't one. You will need to pass the service into your timer object's constrictor or some other method.
On Jul 26, 2012, at 11:24 AM, "Stammler, Daniel" <daniel.stamm...@sap.com> wrote: > Hello, > > we have some problems with the periodical execution of a function. We're > using tapestry version 5.2.6. Since we don't want to update the tapestry > version right now, we can not use the tapestry timer and have to use the Java > Timer. > > Our timertask looks like: > > public class OurTimerTask extends TimerTask { > @Inject > OurService ourService; > > @Override > public void run() { > ourService.execute(); > > } > } > > And the service that starts the timer: > > Timer timer = new Timer("MyTimer"); > OurTimerTask timerTask = new OurTimerTask(); > > // its the date of the first execution. It should be in the > night of the > // current day > > timer.schedule(timerTask, 100,100); > > The problem now is that the Inject in our TimerTask doesn't work. We tried > this in many ways but the object ourService is always null if the run() > function gets called. Without the Timer it works. Is it even possible to > Inject a service for the timer? We hope that anyone can help us. > > Kind regards > Daniel > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org