0

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!

Community
  • 1
  • 1
blaster
  • 845
  • 1
  • 10
  • 25
  • Post [mcve] and full exception stack trace. – MBec Jan 24 '17 at 08:21
  • I cannot post an example. I tried with a minimal example myself to force this error, but I wans't able to. The exception posted is the first exception thrown. – blaster Jan 24 '17 at 08:24
  • 1
    I agree that sometimes it is terribly hard to duplicate the problem using an example. In this case, we need to know what you did for troubleshooting, and the related codes if possible. For example, you have suspected `imageView.setImage(image)` giving you this problem, then you should comment it out to see if it really is that line. If it indeed is that line, you should post as much codes related to that ImageView as possible. If it is not that line, you would still need to comment out a huge number of components in your application, just isolate the causing line. – Jai Jan 24 '17 at 09:18
  • Also give us the stacktrace that really comes from your source code, and provide us with that chunk of source codes. – Jai Jan 24 '17 at 09:19
  • The stacktrace is coming from my source code. There's nothing more. I really cannot post an example, too many proprietary classes. I don't think the error comes from setting null or not in an ImageView. I think there's a slight shift in timing, that it will work with this setting. I need some hints on how to debug such an issue. The more I comment out, the longer the error takes to arise. If you can tell me whats causing such an error, it would already be beneficial. – blaster Jan 24 '17 at 09:42

0 Answers0