How to use Timer on Vaadin

Hi!, Im new kind of new on Vaadin and GWT, in fact I dont know much about GWT, I have problem with a simple application that Im doing on Vaadin, and the class Timer, Im just trying to reload a table every 5 minutes. I saw on some messages on the forums that Timer class from GWT can be used on vaadin but Im gettint this error:


private Timer t = new Timer() {
public void run() {

botonReload= new Button(“Reload”);
botonRecarga.addListener(new Button.ClickListener() {

	public void buttonClick(ClickEvent event) {
		// TODO Auto-generated method stub
		   // t.scheduleRepeating(5000);
		    // Schedule the timer to run once in 5 seconds.



Cause: java.lang.NoClassDefFoundError: com/google/gwt/user/client/Timer
at com.vaadin.event.ListenerMethod.receiveEvent(
at com.vaadin.event.EventRouter.fireEvent(
at com.vaadin.ui.AbstractComponent.fireEvent(
at com.vaadin.ui.AbstractField.fireValueChange(
at com.vaadin.ui.AbstractField.setValue(
at com.vaadin.ui.AbstractSelect.setValue(
at com.vaadin.ui.AbstractSelect.changeVariables(
at com.vaadin.ui.Tree.changeVariables(
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/user/client/Timer
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(
… 28 more
Caused by: java.lang.ClassNotFoundException:
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
… 34 more

I am using it wrong?, How do this work?


Vaadin is a server-side framework, so you cannot use GWT’s client-side classes on the server-side. If you want to use the Timer class, you have to create your own widget. Another option is to use a timer solution on the server-side and add a push or poll component to the application to update the UI when a timer event occurs.

Like Henri said, you need to have a server-side timer and then poll the server from the client side, for this you can use the
addon. If you need to visualize the time in the UI, then take a look at the
Countdown clock