Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8217487

GraalJS engine not working with JavaFX

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux/Open Suse 42.3/jdk1.8.0_181

      A DESCRIPTION OF THE PROBLEM :
      The main problem is when I try used GraalJS engine as default engine for FXMLLoader where I have used javascript for handle the behavior of controls in JavaFX then the exception is thrown. The issue is also discussed on Github (see https://github.com/graalvm/graaljs/issues/83) where the main issue is related to problem with multithreading which not allowed in GraalJS. But are there some solutions how can be achieved but from my point of view has to be changed the logic of loading script in FXMLLoader.

      REGRESSION : Last worked in version 8u181

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Download the application from source (https://github.com/jvaca92/JavaFXGraalJSExample) and build in some IDE and then run the application. Before you should show up screen with button. When you click the message should be set up in the label but instead of that the exception is thrown

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Set up text in the label,
      ACTUAL -

      2019-01-14 10:53:37.195 INFO 25407 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Starting application on vaca with PID 25407 (started by run in /home/jvc/Sandbox/graalvm/javafx-graaljs-example)
      2019-01-14 10:53:37.197 INFO 25407 --- [JavaFX-Launcher] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
      2019-01-14 10:53:37.223 INFO 25407 --- [JavaFX-Launcher] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@cd943f5: startup date [Mon Jan 14 10:53:37 CET 2019]; root of context hierarchy
      2019-01-14 10:53:37.598 INFO 25407 --- [JavaFX-Launcher] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
      2019-01-14 10:53:37.604 INFO 25407 --- [JavaFX-Launcher] o.s.boot.SpringApplication : Started application in 0.599 seconds (JVM running for 1.146)
      2019-01-14 10:53:37.981 WARN 25407 --- [lication Thread] javafx : Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.181
      Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: The value 'com.oracle.truffle.js.runtime.truffleinterop.InteropBoundFunction@75133214' cannot be passed from one context to another. The current context is 0x96a9b1 and the argument value originates from context 0x36dd109.
      at com.oracle.truffle.polyglot.PolyglotLanguageContext.migrateValue(PolyglotLanguageContext.java:696)
      at com.oracle.truffle.polyglot.PolyglotLanguageContext.migrateHostWrapper(PolyglotLanguageContext.java:707)
      at com.oracle.truffle.polyglot.PolyglotLanguageContext.toGuestValue(PolyglotLanguageContext.java:670)
      at com.oracle.truffle.polyglot.PolyglotLanguageContext$ToGuestValueNode.slowPath(PolyglotLanguageContext.java:554)
      at com.oracle.truffle.polyglot.PolyglotLanguageContext$ToGuestValueNode.apply(PolyglotLanguageContext.java:549)
      at com.oracle.truffle.polyglot.PolyglotMap$Cache$Put.executeImpl(PolyglotMap.java:604)
      at com.oracle.truffle.polyglot.PolyglotMap$Cache$Put.executeImpl(PolyglotMap.java:570)
      at com.oracle.truffle.polyglot.HostRootNode.execute(HostRootNode.java:94)
      at com.oracle.truffle.api.impl.DefaultCallTarget.call(DefaultCallTarget.java:98)
      at com.oracle.truffle.polyglot.PolyglotMap.put(PolyglotMap.java:130)
      at com.oracle.truffle.js.scriptengine.GraalJSBindings.put(GraalJSBindings.java:84)
      at com.oracle.truffle.js.scriptengine.GraalJSBindings.put(GraalJSBindings.java:53)
      at java.util.AbstractMap.putAll(AbstractMap.java:281)
      at javafx.fxml.FXMLLoader$ScriptEventHandler.handle(FXMLLoader.java:1677)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Node.fireEvent(Node.java:8411)
      at javafx.scene.control.Button.fire(Button.java:185)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
      at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
      at com.sun.glass.ui.View.notifyMouse(View.java:937)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: Attached Guest Language Frames (1)


      ---------- BEGIN SOURCE ----------
      https://github.com/jvaca92/JavaFXGraalJSExample
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is not workaround

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: