Configuring Cloud SQL and JPA with Eclipse

220 views
Skip to first unread message

Nick Meyvis

unread,
Oct 4, 2014, 2:53:14 PM10/4/14
to google-a...@googlegroups.com
I am trying to configure my GAE Eclipse project with Cloud SQL and JPA.

I followed these documents:


However I continue to get this error:

Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property should be set to a class that is compatible with your database platform

Any insight on this problem would be great as I would like to get back to developing my app.

Below is the relevant code:


persistence.xml

<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">

<persistence-unit name="test_pu">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
        <property name="javax.persistence.jdbc.user" value="root" />
        <property name="eclipselink.ddl-generation" value="create-tables" />
    </properties>
</persistence-unit>
 appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <application>redacted</application>
  <version>1</version>
  <threadsafe>true</threadsafe>
  <use-google-connector-j>true</use-google-connector-j>

  <static-files>
    <include path="**" />
    <include path="**.nocache.*" expiration="0s" />
    <include path="**.cache.*" expiration="365d" />
    <exclude path="**.gwt.rpc" />
  </static-files>

  <system-properties>
    <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    <property name="cloudsql.url.dev" value="jdbc:mysql://127.0.0.1:3306/TestDB?user=root"/>
    <property name="cloudsql.url" value="jdbc:google:mysql://redacted:main/TestDB?user=root"/>
  </system-properties>

</appengine-web-app>

project structure





Cesar Alvarado P.

unread,
Oct 6, 2014, 6:50:16 PM10/6/14
to google-a...@googlegroups.com

These log is local o remote ?

Vinny P

unread,
Oct 7, 2014, 1:08:22 AM10/7/14
to google-a...@googlegroups.com
On Sat, Oct 4, 2014 at 1:53 PM, Nick <nick....@gmail.com> wrote:
I am trying to configure my GAE Eclipse project with Cloud SQL and JPA.

However I continue to get this error:
Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null]



Can you try listing all of the JDBC drivers that are available to your app? Here's some code to do so: http://stackoverflow.com/questions/1839671/finding-installed-jdbc-drivers . At first glance, it looks like Java can't find the appropriate driver. It should be there though, since I see you have the mysql connector JAR in your lib folder.  
 

Just to clarify, you're seeing this error on the local development server correct?

 
 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Reply all
Reply to author
Forward
0 new messages