Chapter 2 : internal exception when running the main class

  3 posts   Feedicon  
Replies: 2 - Last Post: January 30, 2012 15:56
by: matthewcornell
showing 1 - 3 of 3
 
Posted: December 29, 2010 17:01 by steph78
Hello,
I followed the steps to build the chapter 2 exercice. When I run it, there is an error telling me that the program is not able to drop the BOOK table as it doesn't exist :
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Chapter 02 - JPA
[INFO] task-segment: [exec:java]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing exec:java
[INFO] No goals needed for project - skipping
[INFO] [exec:java {execution: default-cli}]
[EL Info]: 2010-12-29 17:58:52.112--ServerSession(16954038)--EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600
[EL Info]: 2010-12-29 17:58:53.321--ServerSession(16954038)--fileHmmmDHmmmdev/BookStore/chapter02/target/classes/_chapter02PU login successful
[EL Warning]: 2010-12-29 17:58:53.558--ServerSession(16954038)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed on 'BOOK' because it does not exist.
Error Code: 30000
Call: DROP TABLE BOOK
Query: DataModifyQuery(sql="DROP TABLE BOOK")
[EL Info]: 2010-12-29 17:58:53.84--ServerSession(16954038)--fileHmmmDHmmmdev/BookStore/chapter02/target/classes/_chapter02PU logout successful
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Dec 29 17:58:53 CET 2010
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------

At the end, the database is not created :
ij> connect 'jdbc:derby://localhost:1527/chapter02DB';
ERREUR 08004 : La connexion a été refusée car la base de données chapter02DB n'a pas été trouvée.
Which means in english : connection refused because the database chapter02DB was not found.

Did I miss something?
Thanks
 
Posted: December 29, 2010 17:17 by steph78
In the file persistence.xml, I commented the lines :
<!--<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/> -->
<!--<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:chapter02DB;create=true"/> -->
and uncommented the lines :
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/chapter02DB;create=true"/>
and it works.
 
Posted: January 30, 2012 15:56 by matthewcornell
Thank you SO MUCH, steph78! Question: Why is this change needed?
Replies: 2 - Last Post: January 30, 2012 15:56
by: matthewcornell
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close