java - LocalDateTime.now() throwing exception when called in a JavaFX context with observer -


i'm writing javafx application fxcontroller observer different class. need last time observer received notification update. problem i'm trying use java8 time api, localdatetime , everytime i'm calling localdatetime.now() it's giving me nullpointerexception pointing tzbd file doesn't exist.

however localdatetime.now() works on system if open console project , run code there.

is problem javafx then? workaround this?

code exception thrown :

public void gettimestamp() {     localdatetime c = localdatetime.now();     system.out.println("grand total has been updated ... @ " + c); }  @override public void update(observable o, object arg) {     grandtotal.settext(         integer.tostring(             controller.getreg().getgrandtotal()         )     );     system.out.println("update() called @ ");     gettimestamp(); } 

here full exception stacktrace :

exception in thread "javafx application thread" java.lang.runtimeexception: java.lang.reflect.invocationtargetexception     @ javafx.fxml.fxmlloader$methodhandler.invoke(fxmlloader.java:1774)     @ javafx.fxml.fxmlloader$controllermethodeventhandler.handle(fxmlloader.java:1657)     @ com.sun.javafx.event.compositeeventhandler.dispatchbubblingevent(compositeeventhandler.java:86)     @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(eventhandlermanager.java:238)     @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(eventhandlermanager.java:191)     @ com.sun.javafx.event.compositeeventdispatcher.dispatchbubblingevent(compositeeventdispatcher.java:59)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:58)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:56)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:56)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.eventutil.fireeventimpl(eventutil.java:74)     @ com.sun.javafx.event.eventutil.fireevent(eventutil.java:49)     @ javafx.event.event.fireevent(event.java:198)     @ javafx.scene.node.fireevent(node.java:8413)     @ javafx.scene.control.button.fire(button.java:185)     @ com.sun.javafx.scene.control.behavior.buttonbehavior.mousereleased(buttonbehavior.java:182)     @ com.sun.javafx.scene.control.skin.behaviorskinbase$1.handle(behaviorskinbase.java:96)     @ com.sun.javafx.scene.control.skin.behaviorskinbase$1.handle(behaviorskinbase.java:89)     @ com.sun.javafx.event.compositeeventhandler$normaleventhandlerrecord.handlebubblingevent(compositeeventhandler.java:218)     @ com.sun.javafx.event.compositeeventhandler.dispatchbubblingevent(compositeeventhandler.java:80)     @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(eventhandlermanager.java:238)     @ com.sun.javafx.event.eventhandlermanager.dispatchbubblingevent(eventhandlermanager.java:191)     @ com.sun.javafx.event.compositeeventdispatcher.dispatchbubblingevent(compositeeventdispatcher.java:59)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:58)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:56)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.basiceventdispatcher.dispatchevent(basiceventdispatcher.java:56)     @ com.sun.javafx.event.eventdispatchchainimpl.dispatchevent(eventdispatchchainimpl.java:114)     @ com.sun.javafx.event.eventutil.fireeventimpl(eventutil.java:74)     @ com.sun.javafx.event.eventutil.fireevent(eventutil.java:54)     @ javafx.event.event.fireevent(event.java:198)     @ javafx.scene.scene$mousehandler.process(scene.java:3757)     @ javafx.scene.scene$mousehandler.access$1500(scene.java:3485)     @ javafx.scene.scene.impl_processmouseevent(scene.java:1762)     @ javafx.scene.scene$scenepeerlistener.mouseevent(scene.java:2494)     @ com.sun.javafx.tk.quantum.glassvieweventhandler$mouseeventnotification.run(glassvieweventhandler.java:381)     @ com.sun.javafx.tk.quantum.glassvieweventhandler$mouseeventnotification.run(glassvieweventhandler.java:295)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.tk.quantum.glassvieweventhandler.lambda$handlemouseevent$354(glassvieweventhandler.java:417)     @ com.sun.javafx.tk.quantum.quantumtoolkit.runwithoutrenderlock(quantumtoolkit.java:389)     @ com.sun.javafx.tk.quantum.glassvieweventhandler.handlemouseevent(glassvieweventhandler.java:416)     @ com.sun.glass.ui.view.handlemouseevent(view.java:555)     @ com.sun.glass.ui.view.notifymouse(view.java:937)     @ com.sun.glass.ui.gtk.gtkapplication._runloop(native method)     @ com.sun.glass.ui.gtk.gtkapplication.lambda$null$49(gtkapplication.java:139)     @ java.lang.thread.run(thread.java:745) caused by: java.lang.reflect.invocationtargetexception     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ sun.reflect.misc.trampoline.invoke(methodutil.java:71)     @ sun.reflect.generatedmethodaccessor1.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ sun.reflect.misc.methodutil.invoke(methodutil.java:275)     @ javafx.fxml.fxmlloader$methodhandler.invoke(fxmlloader.java:1771)     ... 48 more caused by: java.lang.error: java.io.filenotfoundexception: null/lib/tzdb.dat (no such file or directory)     @ sun.util.calendar.zoneinfofile$1.run(zoneinfofile.java:261)     @ java.security.accesscontroller.doprivileged(native method)     @ sun.util.calendar.zoneinfofile.<clinit>(zoneinfofile.java:251)     @ sun.util.calendar.zoneinfo.gettimezone(zoneinfo.java:589)     @ java.util.timezone.gettimezone(timezone.java:560)     @ java.util.timezone.setdefaultzone(timezone.java:666)     @ java.util.timezone.getdefaultref(timezone.java:636)     @ java.util.timezone.getdefault(timezone.java:625)     @ java.time.zoneid.systemdefault(zoneid.java:274)     @ java.time.clock.systemdefaultzone(clock.java:178)     @ java.time.localdatetime.now(localdatetime.java:180)     @ assignment.notifiers.beepmaker.playbeep(beepmaker.java:11)     @ assignment.controller.registrationfxcontroller.calculatediscount(registrationfxcontroller.java:178)     ... 58 more caused by: java.io.filenotfoundexception: null/lib/tzdb.dat (no such file or directory)     @ java.io.fileinputstream.open0(native method)     @ java.io.fileinputstream.open(fileinputstream.java:195)     @ java.io.fileinputstream.<init>(fileinputstream.java:138)     @ sun.util.calendar.zoneinfofile$1.run(zoneinfofile.java:255)     ... 70 more  process finished exit code 0 

found problem. had configloader class overriding java_home. used system.setproperty(key, value) instead of system.setproperties(property)


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -