使用hibernate从Google应用程序引擎连接到Google SQL

使用hibernate从Google应用程序引擎连接到Google SQL,hibernate,google-app-engine,google-cloud-sql,Hibernate,Google App Engine,Google Cloud Sql,我正在尝试从google cloud sql连接到我的数据库 使用hibernate,但我得到以下错误 Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.GoogleDriver 但是我在pom.xml中有依赖关系 <dependency> <groupId>mysql</groupId> <art

我正在尝试从google cloud sql连接到我的数据库 使用hibernate,但我得到以下错误

Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.GoogleDriver
但是我在pom.xml中有依赖关系

<dependency>
     <groupId>mysql</groupId>
     <artifactId>mysql-connector-java</artifactId>
     <version>5.1.38</version>
</dependency>

mysql
mysql连接器java
5.1.38
我这样称呼createEntityManagerFactory

    Map<String, String> properties = new HashMap<>();

    properties.put("javax.persistence.jdbc.driver",
            "com.mysql.jdbc.GoogleDriver");
    properties.put("javax.persistence.jdbc.url",
            System.getProperty("cloudsql.url"));

    EntityManagerFactory emf = Persistence.createEntityManagerFactory(
            "Test", properties);
Map properties=newhashmap();
properties.put(“javax.persistence.jdbc.driver”,
“com.mysql.jdbc.GoogleDriver”);
properties.put(“javax.persistence.jdbc.url”,
System.getProperty(“cloudsql.url”);
EntityManagerFactory emf=Persistence.createEntityManagerFactory(
“测试”,属性);

有人能帮我吗?谢谢

您需要将以下内容放入
appengine web.xml

<use-google-connector-j>true</use-google-connector-j>
true

确保已在已部署版本上声明,并通过更改hibernate版本来解决。现在我使用的是4.2.0.Final,它可以正常工作。