I am trying to use push / update function in java for a web application...
My use : Java (JRE 8) / Primefaces 6.2 / GlassFish 4.1.1 / SqlServer
Goal : Thread in java doing Select into the Sql database. whenever a value has changed, refresh it into my web page
What i have done :
Java side :
A thread (@ApplicationScoped + @ManagedBean(name="Application")) it is doing a select of values each second. When a value has changed -> detect it
When i detect that some values has changed, i am doing this :
PrimeFaces.current().ajax().update("disponibilite:Vehicule");
Of course, my component in my xhtml page is linked to the related values through this :
value="#{Application.m_listeDisponibiliteVehicule}"
BUT
When i am running my app, on the update line, there is a null pointer like if the component with the given id wasn't found by my java side.
java.lang.NullPointerException at org.primefaces.PrimeFaces$Ajax.update(PrimeFaces.java:278) at Database.ThreadDB.run(ThreadDB.java:86)
The problem is :
How can i simply refresh components when my server-side decide to do it.
Thank you for helping
XHTML : https://i.stack.imgur.com/Z5WZT.jpg
Java Side : https://i.stack.imgur.com/CjCnG.jpg