1

I'm using JDK 8 on Mac OS X Yosemite. When I call new JFXPanel(); (to initialize JavaFX), app crashes with this stacktrace:

Prism pipeline init order: sw
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
Dec  1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec  1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec  1 09:27:04 Mac-mini.local java[824] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Dec  1 09:27:04 Mac-mini.local java[824] <Warning>: Invalid Connection ID 0
RenderJob.run: internal exception
java.lang.ArrayIndexOutOfBoundsException: 0
        at java.util.Arrays$ArrayList.get(Arrays.java:3841)
        at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
        at com.sun.glass.ui.Screen.getMainScreen(Screen.java:61)
        at com.sun.prism.sw.SWPipeline.getDefaultResourceFactory(SWPipeline.java:82)
        at com.sun.prism.GraphicsPipeline.getDefaultResourceFactory(GraphicsPipeline.java:120)
        at com.sun.javafx.tk.quantum.QuantumRenderer.lambda$createResourceFactory$414(QuantumRenderer.java:161)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)

I'm using -Dprism.order=sw. What can I do now? Thank you. In Windows, the same code works okay.

I'm using Spring, then initialize JavaFX with:

    @PostConstruct
    public void postConstruct() {
        new JFXPanel();
    }

There app crashes.

Xdg
  • 1,735
  • 2
  • 27
  • 42
  • please post the relevant code – Sebastian S Dec 01 '15 at 08:45
  • Just new JFXPanel(); . – Xdg Dec 01 '15 at 08:46
  • Sorry, can not reproduce this, neither with sw rendering nor hw-accelerated. – Sebastian S Dec 01 '15 at 08:58
  • Isn't it related to that I'm not using Application.launch? I start my app with Spring and then execute 'new JFXPanel();' to initialize JavaFX and after that I run Application.launch(). App crashes in new JFXPanel. Stacktrace shows getMainScreen - no screens detected? :( – Xdg Dec 01 '15 at 09:00
  • Thought you were just calling `new JFXPanel()`? Yes your whole bootstrapping might be relevant. – Sebastian S Dec 01 '15 at 09:02
  • Yes, just new JFXPanel(), then app crashes. – Xdg Dec 01 '15 at 09:08
  • My approach si related to this - http://stackoverflow.com/questions/11273773/javafx-2-1-toolkit-not-initialized . To initialize JavaFX environment. – Xdg Dec 01 '15 at 09:26
  • To get help, you need to create a [MCVE] and [edit] your question to include it. ("Minimal" here almost certainly implies you create this without Spring, etc). What thread are you creating the `JFXPanel` on? (It should be created on the AWT Event Dispatch thread.) – James_D Dec 01 '15 at 12:45
  • I had to launch() JavaFX Application, it works only that way. – Xdg Dec 01 '15 at 13:26
  • But that is also not reliable :( I'm desperate.. everything works under Windows, Mac OS X fails. – Xdg Dec 01 '15 at 14:24
  • Did you set the Scene? – Puce Dec 01 '15 at 15:35
  • Does it run on another OS? – Puce Dec 01 '15 at 15:36
  • Yes, it runs smoothly on Windows. I've observed that it crashes (on OS X) only if I start JavaFX outside main (Start) class. I don't get it.. :( – Xdg Dec 01 '15 at 15:50
  • This sounds like a threading issue to me. It would help if you would post code. What do you mean by "start JavaFX"? If you create a `JFXPanel`, you should not need to call `launch()`, but you should always create the `JFXPanel` on the AWT event dispatch thread. If you are calling `start()` yourself (you shouldn't...), that must be on the FX Application Thread. – James_D Dec 01 '15 at 17:37

0 Answers0