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 221893

Summary: Binary Encode JavaFX CSS files fails - jfxrt.jar needs to be on classpath
Product: javafx Reporter: zmirc
Component: DeploymentAssignee: Petr Somol <psomol>
Status: VERIFIED FIXED    
Severity: normal CC: dstrupl, mmirilovic, neigor, pjiricka
Priority: P1    
Version: 7.3   
Hardware: PC   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: jfx-impl.xml which triggered the error in NetBeans 7.3 RC1

Description zmirc 2012-11-11 12:18:31 UTC
Hello!

If I activate Build -> Packaging -> Binary Encode JavaFX CSS Files in my JavaFX project I get the following:
"nbproject\jfx-impl.xml:996: Error: jfxrt.jar needs to be on classpath for -createbss and for -createJar without -nocss2bin
BUILD FAILED"

nbproject\jfx-impl.xml:996 contains:
<fx:csstobin outdir="${basedir}${file.separator}${build.classes.dir}">
    <fileset refid="cssfiles"/>
</fx:csstobin>

It seems that I'm not the only one having this problem:
http://stackoverflow.com/questions/12628466/netbeans-7-2-jdk-7u7-bundle-javafx-failure-jfxrt-jar-issue

I have NetBeans 7.3 Beta 2 and JDK 7 update 9 for 32 bits.
Comment 1 Stepan Zebra 2012-11-12 11:49:11 UTC
Partially classpath issue of JDK+FX bundle. Partially caused by build infrastructure changes made for NB 7.2.
On NB 7.1.x it was working with standalone FX SDK, but doesn't work now with JDK+FX bundles.
On NB 7.2.x it doesn't work neither with JDK+FX bundles nor with standalone FX SDK.
Comment 2 Petr Somol 2012-11-12 12:18:04 UTC
Just checked that it does work with NB7.3b2, JDK6u33 and FX SDK2.1, although it does issue a misleading warning "Error: failed to msvcr100.dll java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Oracle\JavaFX 2.1 SDK\rt\bin\msvcr100.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform"; the deployment process finishes correctly and bss file is created and included in jar.

The problem seems to be in the JDK+FX bundle, possibly the FX Ant tasks clash with JDK on which NetBeans runs the Ant based build process. Will investigate more..
Comment 3 Petr Somol 2012-11-12 12:55:41 UTC
The difference between JDK+FX bundles and standalone distributions with respect to this issue seems to be in the fact that in standalone case both FX SDK and FX RT contain a copy of jfxrt.jar, while this duplicity is not in JDK+FX bundle. In standalone case the <fx:csstobin> task apparently managed to gain access to jfxrt.jar through SDK definition but does not manage any more in the bundled JDK+FX, where jfxrt.jar is elsewhere than expected. I am going to check whether extending the FX Ant task specific classpath can be done without sideeffects.
Comment 4 zmirc 2012-11-14 08:15:12 UTC
(In reply to comment #1)
> Partially classpath issue of JDK+FX bundle. Partially caused by build
> infrastructure changes made for NB 7.2.
> On NB 7.1.x it was working with standalone FX SDK, but doesn't work now with
> JDK+FX bundles.
> On NB 7.2.x it doesn't work neither with JDK+FX bundles nor with standalone FX
> SDK.

True. It was working with previous versions of NetBeans and independent JavaFX.
Comment 5 Stepan Zebra 2012-11-14 15:46:10 UTC
Raising priority since using the option breaks project execution.

If any viable solution won't be developed until 7.3 code freeze, the option/functionality will have to be removed and (if necessary) every opened existing project since the change should have it's project.properties checked & fixed.
Comment 6 Petr Somol 2012-11-30 09:06:41 UTC
It has been confirmed that the root cause is in FX SDK's PackagerLib, where after the change of directory structure from FX SDK to FX in JDK7 the old relative paths to jfxrt.jar had been left:

http://javafx-jira.kenai.com/browse/RT-26586

As logged in Jira, it is planned to be fixed in FX SDK 2.2.6, ie, JDK7u12. This enabled us to patch NetBeans build scripts:

http://hg.netbeans.org/jet-main/rev/6d633a144ee0

so that the current behavior of FX Application is as follows depending on project settings:

- CSS to BSS disabled, no CSS files in project structure -> no <fx:csstobin> call (no change from previous behavior)

- CSS to BSS enabled, no CSS files in project structure -> no <fx:csstobin> call; this is optimized now, previously the task would have been called with empty fileset

- CSS to BSS enabled, CSS files exist in project structure -> now the behavior depends on current JDK version: for JDK6 and JDK7u12+ <fx:csstobin> is called and BSS files produced correctly. For JDK7 up to 7u11, instead of calling <fx:csstobin> a warning is printed explaining the bug and that the conversion is to be skipped.

Remark: Skipping CSS to BSS conversion on JDKs affected by the bug is harmless. The behavior of FX Applications with CSS and those with equivalent BSS is defined to be equivalent and indeed no difference could have been observed so far. The introduction of BSS format was intended for speed optimization, where processing a binary form of a CSS file by FX RT should presumably be faster than the original CSS. It seems nevertheless difficult to observe any speed difference at least in small or moderately sized projects, or with small number of CSS files involved.
Comment 7 Quality Engineering 2012-12-01 02:55:06 UTC
Integrated into 'main-golden', will be available in build *201212010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6d633a144ee0
User: Petr Somol <psomol@netbeans.org>
Log: #221893 - Binary Encode JavaFX CSS files fails - jfxrt.jar needs to be on classpath
Comment 8 zmirc 2013-02-02 10:13:41 UTC
I can confirm that this bug appeared again in NetBeans 7.3 RC1 on Windows 8 x64 with Java 7 update 13 x86
Comment 9 zmirc 2013-02-02 10:20:45 UTC
Here it is the error report:
C:\Users\Mircea\Documents\NetBeansProjects\mandecentret\nbproject\jfx-impl.xml:2744: The following error occurred while executing this line:
C:\Users\Mircea\Documents\NetBeansProjects\mandecentret\nbproject\jfx-impl.xml:1351: The following error occurred while executing this line:
C:\Users\Mircea\Documents\NetBeansProjects\mandecentret\nbproject\jfx-impl.xml:1032: Error: jfxrt.jar needs to be on classpath for -createbss and for -createJar without -nocss2bin

I will attach "jfx-impl.xml" as "zmirc-jfx-impl.xml"
Comment 10 zmirc 2013-02-02 10:22:12 UTC
Created attachment 130947 [details]
jfx-impl.xml which triggered the error in NetBeans 7.3 RC1
Comment 11 Marian Mirilovic 2013-02-03 17:50:51 UTC
Petr, 
please re-evaluate ASAP. Thanks in advance.
Comment 12 Petr Somol 2013-02-04 14:28:06 UTC
Just verified that binary encoding does work if NB7.3rc is run on JDK7u12 and the FX platform is set to JDK7u12 with the FXSDK/RT in it. 
However, this seems to be the only JDK7 configuration where binary encoding works as expected. In any other JDK7 configuration, including 7u13 and 7u14, the same exception as reported shows up. 

This is a problem inside FX SDK, which should have been corrected at least partly in http://javafx-jira.kenai.com/browse/RT-26586.
Even when this issue is eventually fixed inside FX SDK, there remains the following limitation: with JDK7 the binary encoding works only if the default NB Java Platform (the one on which Ant runs during build) does support it. This limitation follows from the binary encoder implementation inside FX SDK.

The fix in Comment #6 bypasses the problem up to 7u11; it is not clear what we on NB side should do about 7u13+. The options seem to be: disable binary encoding altogether (+issue warnings), or to try to bypass known faulty JDK-FXSDK combinations while issuing a warning (here the problem is that we do not know exactly which future JDKs will work correctly in this respect and when), or just to issue a warning that the operation may not be supported by JDK/FXSDK and give it always a try. Not sure what is best.
Comment 13 Stepan Zebra 2013-02-06 10:43:39 UTC
Can't get it working either. I suggest to completely disable the feature.
Comment 14 Marian Mirilovic 2013-02-06 12:15:56 UTC
This is stopper for NB 7.3 FCS build
Comment 15 Petr Somol 2013-02-06 15:40:27 UTC
fixed in jetmain
http://hg.netbeans.org/jet-main/rev/ff5ca0daf001
and release73 branch
http://hg.netbeans.org/releases/rev/73d4427522bb

The core of the problem is in unreliable state of css-to-bss convertor in all JDK7/8 versions available today, but there is not problem in standalone FX SDK when used with JDK6. The patch above bypasses css-to-bin conversion in JDK7+. As discussed before, this has no limiting impact on function, and there is no case known when this would have impact on FX performance.
Comment 16 Quality Engineering 2013-02-07 01:01:26 UTC
Integrated into 'releases', will be available in build *201302062200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/73d4427522bb
User: Petr Somol <psomol@netbeans.org>
Log: #221893 - Binary Encode JavaFX CSS files fails - jfxrt.jar needs to be on classpath
Comment 17 Quality Engineering 2013-02-07 03:07:25 UTC
Integrated into 'main-golden', will be available in build *201302070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ff5ca0daf001
User: Petr Somol <psomol@netbeans.org>
Log: #221893 - Binary Encode JavaFX CSS files fails - jfxrt.jar needs to be on classpath
Comment 18 Stepan Zebra 2013-02-14 12:37:53 UTC
verified in 7.3, ccs2bin is now blocked for JDK 7 and 8, opening issue 226112 to track unblock progress