11 Replies Latest reply on Mar 17, 2013 10:00 PM by 997394

    JavaFX as JavaEE client

      Hi guys,

      I have a JavaEE application using EJB + JMS + JPA and for client I use a JSF application. Now it is time to develop a java client (just like regular swing clients in java ee applications) but using JavaFX.

      However, I keep getting error when try to launch the application. My environment is:

      Mac OSX 10.8.2
      Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
      GlassFish Server Open Source Edition (build 5)
      Eclise Helios

      - Isn't the JavaFX shipped together with the Java SDK? Why my imports don't work?
      - I can get the imports to work by add external jars to the project, but then I cant load the application using the jnlp created by glassfish.

      Thanks in advance
        • 1. Re: JavaFX as JavaEE client
          dzerjinski wrote:
          - Isn't the JavaFX shipped together with the Java SDK?
          Yes, although in this case what matters is it being part of the runtime (starting from update 5 or 6)
          Why my imports don't work?
          Because it isn't on the boot classpath, for whatever vague reason. You need to add it yourself.
          1 person found this helpful
          • 2. Re: JavaFX as JavaEE client
            Thanks for answer,

            But can I use JavaFX for JavaEE Client Modules without using webservices?

            • 3. Re: JavaFX as JavaEE client
              But can I use JavaFX for JavaEE Client Modules without using webservices?
              Never tried it - but I don't see why not.
              There are numerous ways to connect from a JavaEE Client to a server - what have you tried and why do you want to do it?

              There is an old thread on this subject from a year ago:
              Re: JavaFX 2.0 and EJB 3.0 injection "JavaFX 2.0 and EJB 3.0 injection"
              (the thread discusses using EJB technology in a JavaFX client and some client/server connection options).

              Despite the thread being a year old I haven't seen many posts or samples of people using JavaFX or JavaEE client technology together.
              1 person found this helpful
              • 4. Re: JavaFX as JavaEE client
                I'm working on a small project which works on exactly this basis right now. I have the fundamentals working, so it's definitely possible. I will probably write up a series of blog posts when I have a first version all done; maybe a couple of weeks, depending on my other work commitments. I'll post a link back to this thread when it's up.
                1 person found this helpful
                • 5. Re: JavaFX as JavaEE client
                  Hi James,

                  You said you're working on a similar project. Is the client a standalone or is it packaged in a ear archive and launched using jnlp?

                  • 6. Re: JavaFX as JavaEE client

                    JEE is a big thing - a lot of it outside the scope of a JavaFX developer forum.

                    To get further assistance, it is probably a good idea to describe your intended solution in detail, listing the technology used in the client and how the client is packaged and deployed.

                    It may be best to break your questions out into manageable chunks, each one addressing specific technology which you are using and having issues with.

                    For example does the client use JDBC/JPA?
                    Is it packaged in an EAR?
                    Do you use Jersey Client or do you use RMI to communicate with the server?
                    Do you use CDI in the client?
                    Is the client browser embedded or a self-contained application?
                    • 7. Re: JavaFX as JavaEE client
                      I don't see why not... FX was originally meant for the web and an "RIA..." So I don't see why there would be an issue using it with EE? I am new to EE, and learning now, so I am interested in any issues of compatibility... I don't see why not, especially since it will be part of the JDK and all that when 8 is released :).

                      EDIT: I just started messing with FX8 and JDK 8 and sure enough in the FX8 Samples there is something called "DataApp" that uses a Glassfish server, so I believe we will see much more integration in 8 :D.

                      Edited by: KonradZuse on Feb 18, 2013 2:12 PM
                      • 8. Re: JavaFX as JavaEE client
                        The client is standalone. Right now I only have it running in development mode, via Eclipse or simply by launching from the command line. I will likely keep the standalone structure (but properly packaged) but might try the ear-archive based client. I'm probably a few weeks away from trying that, if indeed I go that route.

                        I have an ejb deployed to glassfish, and retrieved by the client via a JNDI lookup. The ejb represents a simple service that wraps a JPA-driven data access object. It's all working pretty well so far.

                        Edited by: James_D on Feb 18, 2013 6:41 PM
                        • 9. Re: JavaFX as JavaEE client
                          I was thinking about this a bit while I was sleeping, apparently...

                          If what you're aiming to do is have a JavaFX client application bundled up in an ear file, and have the app server automatically create the jnlp file and so on, that might be difficult. The issue is that to get a properly packaged javafx application, you really need to use the packaging tools to create the jar file and, if you're launching via web start, the jnlp file. These will invoke a default main class (com.javafx.main.Main) for you, which checks on versions and then invokes your start(...) method, using a fallback if the runtime is not correctly configured. On the other hand, (and I have far less experience of this) a jee client app is deployed by the app server, which generates the jnlp for you, presumably bundling up some enterprise application jar files, and somehow specifying an annotation processor.

                          So to create a JavaFX client app, deployed in an .ear file on the server, you kind of need two pieces of functionality which are typically automatically created for you, and those deployment processes are going to clash. You'll likely have to do create some of the deployment infrastructure by hand. There may be some nice tricks to doing this; I don't use Maven but there are a few articles around on Maven and JavaFX and those may provide a way forward.

                          As I said, I might try to make this work, but it's not top of my list....
                          • 10. Re: JavaFX as JavaEE client

                            I use Spring's HTTP invoker in my JavaFX project + WebStart !
                            My experience is very good. As a good side effect I can use all the Spring Features ! And...I use iBatis within the Spring Container to access the database.

                            (But using a RESTful or an other technology has a similar effect in combination with a JPA approach...often it depends to the background/experience of a developer what they use)

                            best regards
                            • 11. Re: JavaFX as JavaEE client
                              I am just starting a similar project but I have no expertise with Spring, at all!
                              Could you be so kind to provide me with a HelloWorld kind of project that uses "Spring's HTTP invoker, myBatis, JavaFX project + WebStart"?