I am trying to update my dataTable
every certain time from the Controller
with the following code.
if (tiempMilisegundos > 0) {
timer = new Timer(tiempMilisegundos, new ActionListener() {
public void actionPerformed(ActionEvent e) {
obtenerCatalogos();
org.primefaces.context.RequestContext.getCurrentInstance().update(
"tablaAlertasCped");
}
});
timer.start();
}
But when you get to the RequestContex it shows the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.primefaces.context.RequestContext.getCurrentInstance (RequestContext.java:39) at mx.gob.sat.matce.rni.web.controller.AlertasController.getCatalogs (AlertasController.java:235) at mx.gob.sat.matce.rni.web.controller.AlertasController $ 1.actionPerformed (AlertasController.java:198) at javax.swing.Timer.fireActionPerformed (Timer.java:291) at javax.swing.Timer $ DoPostEvent.run (Timer.java:221) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:209) at java.awt.EventQueue.dispatchEventImpl (EventQueue.java:642) at java.awt.EventQueue.access $ 000 (EventQueue.java:85) at java.awt.EventQueue $ 1.run (EventQueue.java:603) at java.awt.EventQueue $ 1.run (EventQueue.java:601) at java.security.AccessController.doPrivileged (Native Method) at java.security.AccessControlContext $ 1.doIntersectionPrivilege (AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent (EventQueue.java:612) at java.awt.EventDispatchThread.pumpOneEventForFilters (EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:161) at java.awt.EventDispatchThread.run (EventDispatchThread.java:122)
Someone will know the reason, I tried the request
out of the timer
and if it works but in the no longer.