This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222295

Summary: JavaFX maven project doesn't enable Scene Builder Integration
Product: javafx Reporter: pkevin
Component: PlatformAssignee: Tomas Zezula <tzezula>
Status: NEW ---    
Severity: normal CC: dusty, puce, rarchibald, swpalmer, witbrock, yjoan
Priority: P2    
Version: 7.2.1   
Hardware: PC   
OS: Windows 7 x64   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=237662
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 237823    
Bug Blocks: 221184    
Attachments: test sample

Description pkevin 2012-11-16 18:13:00 UTC
On netbeans restart, clicking on an .fxml file in a maven project does not open Scene Builder.  Opening the options dialog at this point doesn't even show the availability of JavaFX under the java options.  The only way to enable the JavaFX platform is to go through the steps of creating a JavaFX FXML project, at which time a info dialog pops up informing me that JavaFX is being activated.  I cancel the project creation at that point and use netbeans and Scene Builder together with no problems.
Comment 1 Petr Somol 2012-11-17 18:03:33 UTC
True, but this is not a bug, this is unfortunately just missing functionality. So far all FX Project type support in NB till 7.3 has been based on Ant only, no explicit Maven support exists in NB so far. We have filed an enhancement request for that that will be subject to planning for next NB release. For this reason I am making this issue part of the enhancement request (by changing type to Enhancement and adding the dependence).
Comment 2 Petr Somol 2012-12-03 09:14:05 UTC
*** Bug 223077 has been marked as a duplicate of this bug. ***
Comment 3 Petr Somol 2012-12-03 09:15:58 UTC
because #223077 voted this to be P1 and here we had two P3 votes, I am setting the issue to P2.
Comment 4 puce 2013-01-24 22:13:25 UTC
Created attachment 130609 [details]
test sample

I've attached the source of a sample for testing.

It is the Drombler FX sample application described here: 

http://sourceforge.net/p/drombler/wiki/GettingStarted/

To build the application:

cd test
mvn clean install

To run the application:

cd test-application
java -Djavafx.verbose=true -Dbinary.css=false -jar target/deployment/standalone/bin/foo.jar --userdir target/userdir

(or just select the test-application project in NetBeans a press the run button)

You can find some FXML-files in the test-sample project. If you double click on them they don't open successfully in the SceneBuilder because of this issue.
Comment 5 Petr Somol 2013-01-25 08:51:05 UTC
(In reply to comment #4)
Thanks, puce. This will indeed help our NB Maven/FX efforts..
Comment 6 puce 2013-01-29 21:42:09 UTC
This issue might be related to the following Scene Builder issue:
http://javafx-jira.kenai.com/browse/DTL-5573
Comment 7 puce 2013-10-22 17:42:35 UTC
Any news on this?
Comment 8 Lou Dasaro 2013-10-23 17:17:40 UTC
Puce, what versions of NetBeans, JDK, Scene Builder and O.S. and did you use for your recent re-teat? 

By the way, I bumped https://javafx-jira.kenai.com/browse/DTL-5573
Comment 9 puce 2013-10-25 13:41:49 UTC
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; de_CH (nb)


Product Version
JavaFX Scene Builder 1.1

Build Information
Version: 1.1-b35, Changeset: 50e3d7cdf394
Date: 2013-08-27 10:45

JavaFX
Toolkit = QuantumToolkit
Pipeline = D3DPipeline
Hardware acceleration ENABLED

Java
1.7.0_40-b43, Oracle Corporation

Operating System
Windows 7, x86, 6.1
Comment 10 puce 2013-10-25 13:44:05 UTC
Try to open the following file in the attached sample:

test-sample/src/main/resources/com/mycompany/test/sample/impl/BottomTestPane.fxml

I'm getting the following error:

com.oracle.javafx.authoring.persist.FXMLDocument$FxmlParseException: Failed to load FXML file
	at com.oracle.javafx.authoring.persist.FXMLDocument.makeParseException(FXMLDocument.java:400)
	at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:311)
	at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:239)
	at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:224)
	at com.oracle.javafx.authoring.Project.forFxml(Project.java:835)
	at com.oracle.javafx.authoring.Project.forFxml(Project.java:807)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:197)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:185)
	at com.oracle.javafx.authoring.DesignerTool.commonInit(DesignerTool.java:513)
	at com.oracle.javafx.authoring.DesignerTool.init(DesignerTool.java:457)
	at com.oracle.javafx.authoring.SceneBuilderLauncher$RunningWithJMXInstance.launch(SceneBuilderLauncher.java:71)
	at com.oracle.javafx.authoring.Main.start(Main.java:72)
	at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
	at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
	at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
	at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NullPointerException
	at javafx.fxml.JavaFXBuilderFactory.createTypeBuilder(JavaFXBuilderFactory.java:159)
	at javafx.fxml.JavaFXBuilderFactory.getBuilder(JavaFXBuilderFactory.java:137)
	at com.oracle.javafx.authoring.persist.SceneBuilderJavaFXBuilderFactory.getBuilder(SceneBuilderJavaFXBuilderFactory.java:68)
	at javafx.fxml.FXMLLoader$RootElement.constructValue(FXMLLoader.java:1102)
	at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
	at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2348)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2164)
	at com.oracle.javafx.authoring.persist.FXMLDocument$2.call(FXMLDocument.java:301)
	at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2216)
	at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:298)
	... 21 more
Comment 11 puce 2013-10-25 13:46:45 UTC
Make sure the classpath gets propagated to SceneBuilder: all sources, resources, generated sources, dependencies etc.
Comment 12 puce 2013-10-25 13:50:30 UTC
On the other machine I'm getting:

com.oracle.javafx.authoring.persist.FXMLDocument$FxmlParseException: Failed to load FXML file
	at com.oracle.javafx.authoring.persist.FXMLDocument.makeParseException(FXMLDocument.java:400)
	at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:311)
	at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:239)
	at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:224)
	at com.oracle.javafx.authoring.Project.forFxml(Project.java:835)
	at com.oracle.javafx.authoring.Project.forFxml(Project.java:807)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:197)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:185)
	at com.oracle.javafx.authoring.DesignerTool.commonInit(DesignerTool.java:513)
	at com.oracle.javafx.authoring.DesignerTool.initFromRemote(DesignerTool.java:436)
	at com.oracle.javafx.authoring.mbeans.SceneBuilderMgt$1.run(SceneBuilderMgt.java:31)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
	at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
	at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:96)
	at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:384)
	at com.sun.glass.ui.EventLoop.enter(EventLoop.java:83)
	at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:521)
	at javafx.stage.Stage.showAndWait(Stage.java:397)
	at com.oracle.javafx.authoring.util.dialog.AbstractModalDialog.showAndWait(AbstractModalDialog.java:84)
	at com.oracle.javafx.authoring.util.dialog.ErrorDialog.showDetailsDialog(ErrorDialog.java:72)
	at com.oracle.javafx.authoring.util.dialog.ErrorDialog.access$000(ErrorDialog.java:15)
	at com.oracle.javafx.authoring.util.dialog.ErrorDialog$1.run(ErrorDialog.java:30)
	at com.oracle.javafx.authoring.util.dialog.AlertDialog.actionButtonPressed(AlertDialog.java:72)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1444)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
	at javafx.event.Event.fireEvent(Event.java:171)
	at javafx.scene.Node.fireEvent(Node.java:6867)
	at javafx.scene.control.Button.fire(Button.java:179)
	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
	at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
	at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
	at javafx.event.Event.fireEvent(Event.java:171)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3311)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3151)
	at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3106)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2248)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:530)
	at com.sun.glass.ui.View.notifyMouse(View.java:924)
	at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
	at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:96)
	at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:384)
	at com.sun.glass.ui.EventLoop.enter(EventLoop.java:83)
	at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:521)
	at javafx.stage.Stage.showAndWait(Stage.java:397)
	at com.oracle.javafx.authoring.util.dialog.AbstractModalDialog.showAndWait(AbstractModalDialog.java:84)
	at com.oracle.javafx.authoring.DesignerTool.showAndWaitDialog(DesignerTool.java:243)
	at com.oracle.javafx.authoring.DesignerTool.showLoadError(DesignerTool.java:267)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:232)
	at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:185)
	at com.oracle.javafx.authoring.DesignerTool.commonInit(DesignerTool.java:513)
	at com.oracle.javafx.authoring.DesignerTool.init(DesignerTool.java:457)
	at com.oracle.javafx.authoring.SceneBuilderLauncher$RunningWithJMXInstance.launch(SceneBuilderLauncher.java:71)
	at com.oracle.javafx.authoring.Main.start(Main.java:72)
	at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
	at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
	at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
	at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
	at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NullPointerException
	at javafx.fxml.JavaFXBuilderFactory.createTypeBuilder(JavaFXBuilderFactory.java:159)
	at javafx.fxml.JavaFXBuilderFactory.getBuilder(JavaFXBuilderFactory.java:137)
	at com.oracle.javafx.authoring.persist.SceneBuilderJavaFXBuilderFactory.getBuilder(SceneBuilderJavaFXBuilderFactory.java:68)
	at javafx.fxml.FXMLLoader$RootElement.constructValue(FXMLLoader.java:1102)
	at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
	at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2348)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2164)
	at com.oracle.javafx.authoring.persist.FXMLDocument$2.call(FXMLDocument.java:301)
	at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2216)
	at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:298)
	... 105 more
Comment 13 puce 2013-10-25 13:53:13 UTC
Ah, I'm getting the second error message when trying to open the same file twice without closing the error dialog inbetween.
Comment 14 Lou Dasaro 2013-10-25 21:00:50 UTC
(In reply to puce from comment #11)
> Make sure the classpath gets propagated to SceneBuilder: all sources,
> resources, generated sources, dependencies etc.

I'm not sure, but something like this might help solve at least one problem:

<?import jfxtras.labs.scene.control.*?>
<?scenebuilder-classpath-element ../../../libraries/JFXtras2/jfxtras-labs-0.1.jar?>
Comment 15 Tomas Zezula 2013-10-30 14:54:04 UTC
Partially fixed in dev, see issue #233825.
The JFX modules enabling is triggered by a content of the pom.xml.
Currently the presence of the JFX is detected by project/packaging == 'jfx' or
by execution of javafxpackager. Which works fine for the JavaFX projects generated by the IDE. Unfortunately there is no maven standard nor convention for JFX so it's impossible to detect unknown mvn project.
However the workaround for such unknown mvn projects is to Create a new JFX application Project which activates the JFX cluster.

Regarding the attached project (using drombler-fx-application packaging) it will require that IDE activates the JFX by the presence of drombler-fx-application packaging. I am evaluation to add it to the detection.
Comment 16 Tomas Zezula 2013-10-30 17:45:42 UTC
jet-main 88a400f343d8
The JFX is activated even for drombler-fx-application packaging.
Comment 17 Tomas Zezula 2013-10-30 17:50:19 UTC
The issue #237823 has to be fixed to properly support drombler-fx-application packaging.
Comment 18 Milos Kleint 2013-10-31 07:03:45 UTC
(In reply to Tomas Zezula from comment #17)
> The issue #237823 has to be fixed to properly support
> drombler-fx-application packaging.

you might want to consider some sort of property that users could use to indicate that the project is a "javafx" project. That could help handling cases we don't currently know about.
Comment 19 Tomas Zezula 2013-10-31 08:22:07 UTC
Yes, it's a good idea to cover these cases by javafx property.
Comment 20 swpalmer 2013-11-18 16:29:30 UTC
This shouldn't be limited to adding support to Maven projects. It should work with any project type, including Gradle.
Comment 21 swpalmer 2013-11-18 16:45:39 UTC
Why does it even matter what the project "type" is?  If NB is launching Scene Builder because the user tried to open a FXML file that was part of the project, why wouldn't it always assume that Scene Builder needs to know the project classpath, etc. ?