Forum Stats

  • 3,827,825 Users
  • 2,260,824 Discussions
  • 7,897,388 Comments

Discussions

JavaFX could not create platform window

User_HLZR7
User_HLZR7 Member Posts: 1 Green Ribbon

Hi,

we have a JAvaFX application running. Sometimes the application crashes with the following exception.

It's OpenJDK 11 with OpenFX14 running on Windows 10 machines.
Any idea what can cause this problem

java.lang.RuntimeException: could not create platform window

at javafx.graphics/com.sun.glass.ui.Window.<init>(Window.java:294)

at javafx.graphics/com.sun.glass.ui.win.WinWindow.<init>(WinWindow.java:54)

at javafx.graphics/com.sun.glass.ui.win.WinApplication.createWindow(WinApplication.java:219)

at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.initPlatformWindow(WindowStage.java:201)

at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.init(WindowStage.java:143)

at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.createTKPopupStage(QuantumToolkit.java:678)

at javafx.graphics/javafx.stage.PopupWindow.doVisibleChanging(PopupWindow.java:514)

at javafx.graphics/javafx.stage.PopupWindow$1.doVisibleChanging(PopupWindow.java:107)

at javafx.graphics/com.sun.javafx.stage.PopupWindowHelper.visibleChangingImpl(PopupWindowHelper.java:57)

at javafx.graphics/com.sun.javafx.stage.WindowHelper.visibleChanging(WindowHelper.java:73)

at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1064)

at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)

at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)

at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1174)

at javafx.graphics/javafx.stage.Window.show(Window.java:1189)

at javafx.graphics/javafx.stage.PopupWindow.showImpl(PopupWindow.java:472)

at javafx.graphics/javafx.stage.PopupWindow.show(PopupWindow.java:437)

at javafx.controls/javafx.scene.control.Tooltip$TooltipBehavior.lambda$new$0(Tooltip.java:899)

at javafx.graphics/javafx.animation.Animation.finished(Animation.java:1131)

at javafx.graphics/javafx.animation.AnimationAccessorImpl.finished(AnimationAccessorImpl.java:49)

at javafx.graphics/com.sun.scenario.animation.shared.SingleLoopClipEnvelope.timePulse(SingleLoopClipEnvelope.java:101)

at javafx.graphics/javafx.animation.Animation.doTimePulse(Animation.java:1101)

at javafx.graphics/javafx.animation.Animation$1.lambda$timePulse$0(Animation.java:186)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at javafx.graphics/javafx.animation.Animation$1.timePulse(Animation.java:185)

at javafx.graphics/com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)

at javafx.graphics/com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)

at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:559)

at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:543)

at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:536)

at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:342)

at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)

at java.base/java.lang.Thread.run(Thread.java:834)

User_V5WAG

Answers

  • User_V5WAG
    User_V5WAG Member Posts: 1 Red Ribbon

    Yes.


    I have discovered the same problem in java 16 and all the way back to java 11.

    If I run the following code:

    package test;


    import javafx.application.Application;

    import javafx.scene.Scene;

    import javafx.scene.layout.StackPane;

    import javafx.stage.Popup;

    import javafx.stage.Stage;


    public class TestFX extends Application {


    @Override

    public void start(Stage primaryStage) {

    System.out.println("javafx.runtime.version: " + System.getProperties().get("javafx.runtime.version"));

    Stage stage = new Stage();

    Scene scene = new Scene(new StackPane());

    stage.setScene(scene);

    stage.show();

    Popup popOver = new Popup();

    for (int i = 0; i < 99999; i++) {

    popOver.show(scene.getRoot(), 1, 1);

    popOver.hide();

    System.out.println(i);

    }

    }


    public static void main(String[] args) {

    launch(args);

    }

    }

    It will crash with after some iterations, it can vary.

    the error stacktrace:

    Exception in Application start method

    Exception in thread "JavaFX Application Thread" java.lang.NullPointerException

    at javafx.base/com.sun.javafx.binding.ExpressionHelper.removeListener(ExpressionHelper.java:73)

    at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.removeListener(ReadOnlyBooleanPropertyBase.java:67)

    at javafx.graphics/javafx.stage.PopupWindow.unbindOwnerFocusedProperty(PopupWindow.java:895)

    at javafx.graphics/javafx.stage.PopupWindow.doVisibleChanged(PopupWindow.java:542)

    at javafx.graphics/javafx.stage.PopupWindow$1.doVisibleChanged(PopupWindow.java:111)

    at javafx.graphics/com.sun.javafx.stage.PopupWindowHelper.visibleChangedImpl(PopupWindowHelper.java:63)

    at javafx.graphics/com.sun.javafx.stage.WindowHelper.visibleChanged(WindowHelper.java:77)

    at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1160)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)

    at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1187)

    at javafx.graphics/javafx.stage.Window.hide(Window.java:1212)

    at javafx.graphics/javafx.stage.PopupWindow.hide(PopupWindow.java:486)

    at javafx.graphics/javafx.stage.PopupWindow.lambda$new$0(PopupWindow.java:147)

    at javafx.base/javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:86)

    at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)

    at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)

    at javafx.graphics/javafx.scene.Node$TreeShowingPropertyReadOnly.invalidate(Node.java:8479)

    at javafx.graphics/javafx.scene.Node.setTreeShowing(Node.java:8436)

    at javafx.graphics/javafx.scene.Node.updateTreeShowing(Node.java:8427)

    at javafx.graphics/javafx.scene.Node.lambda$new$2(Node.java:1010)

    at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)

    at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)

    at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:78)

    at javafx.base/javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)

    at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1187)

    at javafx.graphics/javafx.stage.Window.hide(Window.java:1212)

    at javafx.graphics/com.sun.javafx.stage.WindowPeerListener.closed(WindowPeerListener.java:105)

    at javafx.graphics/com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:144)

    at javafx.graphics/com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:40)

    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)

    at javafx.graphics/com.sun.javafx.tk.quantum.GlassWindowEventHandler.lambda$handleWindowEvent$4(GlassWindowEventHandler.java:176)

    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)

    at javafx.graphics/com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:174)

    at javafx.graphics/com.sun.glass.ui.Window.handleWindowEvent(Window.java:1336)

    at javafx.graphics/com.sun.glass.ui.Window.notifyDestroy(Window.java:1250)

    at javafx.graphics/com.sun.glass.ui.win.WinWindow._close(Native Method)

    at javafx.graphics/com.sun.glass.ui.Window.close(Window.java:352)

    at javafx.graphics/com.sun.glass.ui.win.WinWindow.close(WinWindow.java:316)

    at javafx.graphics/com.sun.glass.ui.Application.terminate(Application.java:394)

    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$exit$13(QuantumToolkit.java:831)

    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithRenderLock(QuantumToolkit.java:430)

    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.exit(QuantumToolkit.java:827)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$tkExit$16(PlatformImpl.java:614)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:474)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)

    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)

    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)

    at java.base/java.lang.Thread.run(Thread.java:831)

    java.lang.reflect.InvocationTargetException

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:567)

    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)

    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:567)

    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)

    Caused by: java.lang.RuntimeException: Exception in Application start method

    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)

    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)

    at java.base/java.lang.Thread.run(Thread.java:831)

    Caused by: java.lang.RuntimeException: could not create platform window

    at javafx.graphics/com.sun.glass.ui.Window.<init>(Window.java:294)

    at javafx.graphics/com.sun.glass.ui.win.WinWindow.<init>(WinWindow.java:54)

    at javafx.graphics/com.sun.glass.ui.win.WinApplication.createWindow(WinApplication.java:219)

    at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.initPlatformWindow(WindowStage.java:201)

    at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.init(WindowStage.java:143)

    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.createTKPopupStage(QuantumToolkit.java:678)

    at javafx.graphics/javafx.stage.PopupWindow.doVisibleChanging(PopupWindow.java:514)

    at javafx.graphics/javafx.stage.PopupWindow$1.doVisibleChanging(PopupWindow.java:107)

    at javafx.graphics/com.sun.javafx.stage.PopupWindowHelper.visibleChangingImpl(PopupWindowHelper.java:57)

    at javafx.graphics/com.sun.javafx.stage.WindowHelper.visibleChanging(WindowHelper.java:73)

    at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1065)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)

    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)

    at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1187)

    at javafx.graphics/javafx.stage.Window.show(Window.java:1202)

    at javafx.graphics/javafx.stage.PopupWindow.showImpl(PopupWindow.java:472)

    at javafx.graphics/javafx.stage.PopupWindow.show(PopupWindow.java:417)

    at test.TestFX.start(TestFX.java:35)

    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:474)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)

    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)

    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)

    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)

    ... 1 more

    Exception running application test.TestFX


    I see this as a critical error because our customers experiences that popups doesn't show..

    user8614587