That doesn't look quite right - on GAE Standard, it should be using the injected driver, not the socket factory. It might also need a user and password in that path.
On Fri, Jan 12, 2018 at 6:29 AM, Nikita Koroed <[email protected]> wrote: > I want to use Spring Boot Data JPA on GAE server and Google Cloud SQL > MySql as database. > > I take appengine-standard-java8/springboot-appengine-standard > <https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard> > as base app. > > I get this error on app engine server: > > com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could > not create socket factory 'com.google.cloud.sql.mysql.SocketFactory' due to > underlying exception: > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > at > com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:806) > at > com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:274) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.lang.ClassCastException: > com.google.cloud.sql.mysql.SocketFactory cannot be cast to > com.mysql.jdbc.SocketFactory > at com.mysql.jdbc.MysqlIO.createSocketFactory(MysqlIO.java:3325) > > > full log in attachments. > > > On local server in SDK environment all work fine. > > > New dependencies: > > <dependency> > <groupId>org.springframework.boot</groupId> > <artifactId>spring-boot-starter-data-jpa</artifactId> > </dependency> > > <dependency> > <groupId>mysql</groupId> > <artifactId>mysql-connector-java</artifactId> > <version>6.0.5</version> > </dependency> > > <dependency> > <groupId>com.google.cloud.sql</groupId> > <artifactId>mysql-socket-factory-connector-j-6</artifactId> > <version>1.0.4</version> > </dependency> > > > i put <use-google-connector-j>true</use-google-connector-j> in > appengine-web.xml > > And created application.yml > > spring: > datasource: > url: > jdbc:mysql://google/test-db?cloudSqlInstance=test-project:europe-west3:my-test-db&socketFactory=com.google.cloud.sql.mysql.SocketFactory > username: root > password: db-pwd > > > full app in attachments > > what am I doing wrong? > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/google-appengine. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-appengine/dbe522ae-ce37-4e1e-8e26- > 65957a51e41b%40googlegroups.com > <https://groups.google.com/d/msgid/google-appengine/dbe522ae-ce37-4e1e-8e26-65957a51e41b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- * • **Les Vogel* * • *Cloud Developer Relations * • *[email protected] * • *+1-4 <%2B1-650-338-7103>08-676-7023 -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/CAGB1p5g9ebMVcA3kZP5DZ74ejauK7aRmouwtjD%3DDQ148mkVmFw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
