3 Replies Latest reply on Mar 25, 2014 11:00 AM by Randahl Fink Isaksen

    How do I make jfxrt.jar available?

    Randahl Fink Isaksen Novice

      Both in my rich client and in my EJBs I am using a framework which can optionally be used with JavaFX. This means that when my EJBs are running inside WildFly the JavaFX runtimer jar jfxrt.jar needs to be available.


      Since Java 8, jfxrt.jar has moved into the $JAVA_HOME/jre/lib/ext folder, which means the jfxrt.jar classes are loaded automatically if you start a JavaFX based application.


      However, when I deploy to WildFly I get typical WildFly StartException caused by:

      java.lang.NoClassDefFoundError: javafx/scene/Node

      This tells me, that WildFly does not load JavaFX automatically. I have been reading up on WildFly class loading and modules, and it seems I am supposed to define jfxrt.jar as a WildFly module, so first I have created the folder


      and inside that folder I have created a module.xml file containing this XML:

      <module xmlns="urn:jboss:module:1.1" name="javafx.api">


              <system export="true">


                    <path name="javafx/animation"/>

                    <path name="javafx/application"/>



      With a path for each of the javafx packages.


      This, however, had no effect, so I tried adding a dependency on this module, by typing this in my ejb.jar's manifest.mf file:

      Dependency: javafx.api


      This also had no effect. Then I tried telling WildFly to always make the javafx.api module available globally by adding this to WildFly's domain.xml file:

      <profile name="default">

        <!-- javafx -->

        <subsystem xmlns="urn:jboss:domain:ee:1.0" >           


                <module name="javafx.api" slot="main"/>           





      This also had no effect.


      Now, I know could copy jfxrt.jar directly into my WildFly module, but that's not what I am looking for. Rather, I want WildFly to make available whatever JavaFX classes the JRE comes with – just like the JDK does, when I run an app on the comand line. I would be grateful, if anyone could offer some ideas for how to do that.

        • 1. Re: How do I make jfxrt.jar available?
          Tomaž Cerar Master

          First option you did with "Dependency: javafx.api" should work.


          Maybe you are just missing some of the dependencies for this module or you just missed some package/path.


          does exception change in any way when you add the module as dependency?

          • 2. Re: How do I make jfxrt.jar available?
            Randahl Fink Isaksen Novice

            Nope, the exception has been the same each time.

            • 3. Re: How do I make jfxrt.jar available?
              Randahl Fink Isaksen Novice

              I have found solution to this. It turns out, WildFly allows you to place a jboss-deployment-structure.xml file in the META-INF folder of your EAR file (or WAR). Using this file you can tell WildFly to make the missing classes available to your application.

              The positive aspect of this is, the configuration follows your application, meaning your can install it on WildFly without reconfiguring the server itself.


              <?xml version="1.0" encoding="UTF-8"?>

              <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">



                          <system export="true">


                <path name="javafx/animation"/>

                <path name="javafx/application"/>

                <path name="javafx/beans"/>

                <path name="javafx/beans/binding"/>

                <path name="javafx/beans/property"/>

                <path name="javafx/beans/property/adapter"/>

                <path name="javafx/beans/value"/>

                <path name="javafx/collections"/>

                <path name="javafx/collections/transformation"/>

                <path name="javafx/concurrent"/>

                <path name="javafx/css"/>

                <path name="javafx/embed/swing"/>

                <path name="javafx/embed/swt"/>

                <path name="javafx/event"/>

                <path name="javafx/fxml"/>

                <path name="javafx/geometry"/>

                <path name="javafx/print"/>

                <path name="javafx/scene"/>

                <path name="javafx/scene/canvas"/>

                <path name="javafx/scene/chart"/>

                <path name="javafx/scene/control"/>

                <path name="javafx/scene/control/cell"/>

                <path name="javafx/scene/effect"/>

                <path name="javafx/scene/image"/>

                <path name="javafx/scene/input"/>

                <path name="javafx/scene/layout"/>

                <path name="javafx/scene/media"/>

                <path name="javafx/scene/paint"/>

                <path name="javafx/scene/shape"/>

                <path name="javafx/scene/text"/>

                <path name="javafx/scene/transform"/>

                <path name="javafx/scene/web"/>

                <path name="javafx/stage"/>

                <path name="javafx/util"/>

                <path name="javafx/util/converter"/>

                <path name="netscape/javascript"/>