5 Replies Latest reply: May 22, 2013 10:03 PM by KonradZuse RSS

    Issue with DataApp Sample in JavaFX.

    KonradZuse
      Okay so I downloaded the Samples pack here http://jdk8.java.net/download.html or here http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html at the bottom.


      Inside is one called DataApp which requires setting up an SQL DB, and connecting to it.


      In Netbeans8 I get an error about not having RestLib api inside the DataAppClient which according to the setup DataAppClient - The JavaFX 2.0 client application. inside there you can see a package with packages that wont import such as

      import com.sun.jersey.api.client.Client;
      import com.sun.jersey.api.client.UniformInterfaceException;
      import com.sun.jersey.api.client.WebResource;
      import com.sun.jersey.api.json.JSONConfiguration;

      So why am I in a Java 8 samples pack needing FX 2? Though I'm not sure if it's FX8 yet, I just didn't think the 2.0 client would work.

      So I tried Netbeans 7.3 to see if it would work. At first the DataAppClient was fine, but I see the DataAppPreloader will not run because it uses Package javafx.something which apparently is new in Java 8.....



      So now I'm stuck, wondering why Restlib doesn't exist... I looked it up, and it says it's used for Web services, but I don't have it, nor does it say to install it in the readme.




      not existing, which I guess has to do with the RestLib?


      Anyone have any ideas?


      EDIT: So I just downloaded the version for FX2, and I am still getting the same error when I run it, though nothing shows "errors" in the packages. Maybe I just needed to run it correctly for it to work, so not what is this error tellingme

      Creating "dataapp" user and "APP" database...
      Executing commands
      Failed to execute:  INSERT INTO user VALUES ('localhost','dataapp','*B974A83D18BB105D0C9186756F485406E6E6039B','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL)
      C:\Users\Konrad\Downloads\javafx_samples-2_2_7-windows\javafx-samples-2.2.7\src\DataApp\DataAppLoader\build.xml:84: 
      java.sql.SQLException: Column count doesn't match value count at row 1
           at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
           at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
           at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
           at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618)
           at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
           at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:842)
           at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:681)
           at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:775)
           at org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:745)
           at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLExec.java:1043)
           at org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000(SQLExec.java:985)
           at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:653)
           at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
           at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
           at org.apache.tools.ant.Task.perform(Task.java:348)
           at org.apache.tools.ant.Target.execute(Target.java:392)
           at org.apache.tools.ant.Target.performTasks(Target.java:413)
           at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
           at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
           at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
           at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
           at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:283)
           at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541)
           at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
      BUILD FAILED (total time: 6 seconds)
      I have put the 1.18 derby file into glassfish, download and set up MySQL using a netbeans reference,I had set my root password and such as well.

      The only thing I haven't done is created a DB, but I don't think I need one, and the instructions don't say anything.

      I have Netbenans 7.3, 8, and Java vers 7_15 and 8 build 82.

      GlassFish 3.1.2 as well as 4.0 build 76 which I haven't installed.

      I hav e MySQL 5.6

      Java FX 2.0 and 8 build 82.

      The instructions are


      DataApp Installation Guide
      
      Table of Contents
      
      Prerequisites
      Setting Up the DataApp Sample
      Running the Sample
      NetBeans Projects for the Sample
      Licensing
       
      
      Prerequisites
      
      You must have the following software installed to run the DataApp sample:
      
      Java SDK 1.6.0_24 or later 
      Available at http://www.oracle.com/technetwork/java/javase/downloads/index.html.
      
      JavaFX 2.0 SDK or later
      Available at http://javafx.com/downloads/all.jsp.
      
      MySQL 5.5 or later 
      Available at http://dev.mysql.com/downloads/.
      You need to know the root password for your installation.
      
      Netbeans 7.1 with Java EE and GlassFish 3.1.1 or later 
      Available at http://netbeans.org/downloads/.
      
      Run the NetBeans installer to install NetBeans and GlassFish to the default locations.
      
       
      
      Setting Up the DataApp Sample
      
      Install the MySQL drivers into GlassFish.
      
      Manually copy the mysql-connector-java-5.1.13-bin.jar file from the netbeans-install-dir\ide\modules\ext\ to the glassfish-install-dir/glassfish/lib directory, where netbeans-install-dir and glassfish-install-dir are the directories into which the products were installed. For example, on Windows the install directory for products is typically in the C:\Program Files\ or C:\Program Files (x86)\ directories.
      
      Open the following DataApp projects in NetBeans by selecting File ->Open Project and navigating to the location of the DataApp sample:
      
      DataAppClient
      DataAppLibrary
      DataAppLoader
      DataAppPreloader
      DataAppServer
      Configure and create the database (only needs to be done once): 
      
      In NetBeans, right-click the DataAppLoader project.
      Select Run.
      Enter your MySQL root password when prompted.
      Wait until you see the message that the build has successfully finished, which takes approximately 5 to 15 minutes.
      
       
      
      Running the Sample
      
      Start the server:
      
      In NetBeans, right-click the DataAppServer project.
      Select Run.
      Wait until a browser window opens that says: YOU ARE DONE!
      
      (Optional) Start the standalone client:
      
      In NetBeans, right-click the DataAppClient project.
      Select Run.
       
      
      NetBeans Projects for the Sample
      
      DataAppLibrary - Contains the following data:
      
      Database tables
      ORM model to database tables
      DataAppLoader - Application that is run once to perform the following tasks:
      
      Creates the database.
      Loads all of the static data for the data app.
      Creates some historical data.
      DataAppServer - Web server that performs the following tasks:
      
      Simulates auto sales and persists them to the database.
      Provides access to the database through web services.
      DataAppClient - The JavaFX 2.0 client application.
      
       
      
      Licensing
      
      The license for the DataAppLoader/zip_code_inserts.sql file is the Creative Commons Attribution-ShareAlike license, which is available at http://creativecommons.org/licenses/by-sa/2.0/.
      
      The license for all other files is the BSD style license:
      
      /*
      * Copyright (c) 2008, 2011 Oracle and/or its affiliates.
      * All rights reserved. Use is subject to license terms.
      *
      * This file is available and licensed under the following license:
      *
      * Redistribution and use in source and binary forms, with or without
      * modification, are permitted provided that the following conditions
      * are met:
      *
      * - Redistributions of source code must retain the above copyright
      * notice, this list of conditions and the following disclaimer.
      * - Redistributions in binary form must reproduce the above copyright
      * notice, this list of conditions and the following disclaimer in
      * the documentation and/or other materials provided with the distribution.
      * - Neither the name of Oracle Corporation nor the names of its
      * contributors may be used to endorse or promote products derived
      * from this software without specific prior written permission.
      *
      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
      * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
      * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      */
      Copyright © 2011, Oracle and/or its affiliates. All rights reserved
      Edited by: KonradZuse on Mar 27, 2013 9:39 AM

      Edited by: KonradZuse on Mar 27, 2013 9:51 AM

      Edited by: KonradZuse on Mar 27, 2013 9:58 AM
        • 1. Re: Issue with DataApp Sample in JavaFX.
          1000635
          I am getting the same propblem if any one can help plzzzzzzzz
          • 2. Re: Issue with DataApp Sample in JavaFX.
            nlorain-Oracle
            What version of NetBeans have you downloaded. You must download NetBeans for Java EE in order to get the REST api.

            BTW, JavaFX has been completly integrated with JDK 7 (and JDK 8 Early Access) since JavaFX 2.2/Java SE 7u6 (August 2012), which is why the JavaFX samples are downloaded from the same location as the Java SE samples
            • 3. Re: Issue with DataApp Sample in JavaFX.
              KonradZuse
              I have both the newest Netbeans Lambda8, as well as Netbean 7.3 EE, with Glassfish 3.2.3.


              Restful was giving me issues in 8 I believe, but the issue, as you can see, is parsing through the DB.


              Now I didn't set up anything via JDBC, because there was nothing specified, tho another example asked for it......
              • 4. Re: Issue with DataApp Sample in JavaFX.
                lmei007
                I found the same issue but resolved it by myself. The user table of the MySQL changed, my guess. You need to add another 'Y' or 'N' to the end of this statement in the build.xml of DataAppLoader:

                INSERT INTO user VALUES ('localhost','dataapp','*B974A83D18BB105D0C9186756F485406E6E6039B','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL,'N');

                The original one is like this:

                INSERT INTO user VALUES ('localhost','dataapp','*B974A83D18BB105D0C9186756F485406E6E6039B','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL);

                The new column added is password_expired. Y or N to indicate the password is good or not.
                • 5. Re: Issue with DataApp Sample in JavaFX.
                  KonradZuse
                  Good stuff man! I really iddn't have much DB knowledge at the time, so It's good to learn something :).