On Sep 21, 10:11 am, Rammohan Vadlamani <rmmo...@gmail.com> wrote: > Hello everyone, > In the following example I have created a database as > books. I have checked the database, the tables have been created properly. > But still I get an error stating that the tables were not found. can anyone > please help me with regards to what may have gone wrong. > Thanks to everyone in advance. There are a number of missing files in your project: - persistence.xml (from books project) - source from bookstore project (because your way of incorporating the jar files is pretty wrong, at least it does not come through the zip you have sent) - some unnecessary endorsed libraries - a build system based on ant versus the initial whole j2ee 5 tutorial - a wrong server
I have not go through the whole process of transforming all bookstores projects to directly work with GlassFish v.3 prelude in NetBeans 6.8. I have simply incorporate the necessary source files from bookstore project, throw away the build system and replace it with a standard build system from a mere web application in NetBeans 6.8 (with just a custom target for the digital clock, but anyway it does not work on my system since this is a java applet and the plugin is not found on a Mac Intel) - works also in NetBeans 6.9. I detail here the process: A - Create the necessary tables 1 - Open NetBeans 6.8 or 6.9 2 - If it is the first time you use it, just create a project from samples category which uses a database (in Samples -> Web Services the project REST: Customer Database (Java EE 5) is convenient for this). You just have to create the project, then you could throw it away. It will create in NetBeans the necessary JavaDB drivers and a minimal JavaDB database. Or if it does not create the sample database, you can find it in Lab REST overview exercise 3 in web services course. If you have already the drivers and the sample database in NetBeans 6.8 or 6.9, skip this step. 3 - Start the JavaDB Server, connect it using the JavaDB(network) driver with the standard localhost, 1527, sample, app, app incantation. Right click on tables and select execute command, in the sql editor paste the contents of the sql script located in common->sql- >tutorial.sql from the original java EE 5 tutorial B - Add missing files 1 - Add persistence.xml from bookstore->src->META-INF and put it in src->conf in bookstore2 (it should have toplink essentials as provider and jdbc/sample as jta data source and its persistence unit name should be book). Do not add a jndi name in GlassFish, it is not necessary for this example to work. 2 - From bookstore project add: a - cart-->ShoppingCart.java ShoppingCartItem.java b - database->Book.java c - exception-> BookNotFoundException.java -> BooksNotFoundException.java -> OrderException.java d - messages -> BookstoreMessages_de_DE.java BookstoreMessages_en_US.java BookstoreMessages_es_MX.java BookstoreMessages_fr_FR.java BookstoreMessages.java They all should be under com/sun/bookstore package C - Change the build system 1 - Create a new web service project. It will create a standard web service build system. You will use it to replace the one in bookstore 2, then you may throw away the project. 2 - Replace the build.xml file inside bookstore2 by the one in the newly created web application. Just the name of the project at the top of the file (aka WebApplication1 by bookstore2) 3 - Add those lines at the end of build.xml file just before the project end tag: <target name="-pre-dist"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. -- > <echo message="Pre Dist"/> <copy todir="${build.web.dir}"> <fileset dir="${build.classes.dir}" > <include name="clock/*.class"/> </fileset> </copy> </target> This is to ensure the clock digital applet is found (though does not work on my system, but this is another story and that does not impede the project to run. If it is annoying you, just through away the applet - java file, fragment of jsp:pluginl in prelude.jspf file, and don't add the custom target in build.xml file). 4 - Replace build-impl.xml by the one you created in the new web application D - Pick the right server and the right JDK 1 - Right-click the project, select properties, Choose GlassFish v3 Domain in Run 2 - Throw away any libraries you might have added in Libraries 3 - Chose Java Platform JDK 1.6 (or whatever it is named on your system) in Libraries also E - Build, clean and run 1 - Start GlassFish server 2 - Build and Clean the project 3 - Deploy the project 4 - Run the project and finally enjoy. Normally you would have done this kind of process for all bookstore projects and then include the necessary project into one another. Hope it helps. Michèle Garoche -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en