I'm developing a big java fx application with http communication, sockets etc.. The content of the messages update the GUI-elements. I am aware of the fact that I need to call Platform.runlater()
whenever I want to update a javafx element from a normal thread. I am 99% sure, I have this everywhere. But the application is quite big and not everything is done by myself.
To give some more information, there is a TimerTask every 100ms which creates an Image from a byte-array. The call for imageView.setImage(image)
is done in Platform.runlater()
.
However, I get the following error (using java 1.8.0.0_102):
2017-01-20T05:03:47,030 FATAL [JavaFX Application Thread] uncaughtException - Thread[JavaFX Application Thread,5,main]
java.lang.NullPointerException
at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Unknown Source) ~[jfxrt.jar:?]
at javafx.scene.Scene$ScenePulseListener.pulse(Unknown Source) ~[jfxrt.jar:?]
at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Unknown Source) ~[jfxrt.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_77]
at com.sun.javafx.tk.Toolkit.runPulse(Unknown Source) ~[jfxrt.jar:?]
at com.sun.javafx.tk.Toolkit.firePulse(Unknown Source) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) ~[jfxrt.jar:?]
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(Unknown Source) ~[jfxrt.jar:?]
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) ~[jfxrt.jar:?]
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[jfxrt.jar:?]
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source) ~[jfxrt.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Any suggestions how to find the source of this error? As I mentioned above I checked all threads that nothing fx related is called on an fx thread. What I am not sure, are you allowed to load an Image (a Java FX Image) on a non fx thread? I tested it in a small sample application and it gave no error..
Edit I found this question: same error, but I tried to force the scene update with no luck.
Thanks for any ideas!