Reputation: 65
I am trying to connect to my database from google cloud sql using hibernate, but I get the following error...
Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.GoogleDriver
but I have the dependency in the pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
I call createEntityManagerFactory this way...
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);
Could someone help me? Thanks
Upvotes: 2
Views: 297
Reputation: 35961
You need to put following into appengine-web.xml
:
<use-google-connector-j>true</use-google-connector-j>
Upvotes: 1