0

I'm trying to deploy my Spring Boot 3 app to Google App Engine but I'm getting the error org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect]. I see the exceptions which occurred on the dashboard:

Is the Google App Engine Ubuntu 22 VM missing the mysql driver or so?

Locally and in my IDE IntelliJ IDEA, the REST API works fine and does not run into this error.

My Google App Engine app.yaml config looks as follows:

runtime: java
env: flex
runtime_config:
  operating_system: "ubuntu22"
  runtime_version: "17" # When not specified, uses the latest version available
env_variables:
  SPRING_PROFILES_ACTIVE: "gcp,mysql"
handlers:
  - url: /.*
    script: this field is required, but ignored
manual_scaling:
  instances: 1

Another strange thing is that defining my database connection in an application-mysql.properties file did not pick up the connection properties (incorrect) but defining it in an application.properties file made Google App Engine pick up the properties despite the fact that Spring Boot said that the profiles gcp and mysql are active (correct).

My deployment command is: mvn clean package appengine:deploy -P cloud-gcp -DskipTests

How do I successfully connect to my Google Cloud Engine mysql instance? My database config is:

spring.datasource.url=jdbc:mysql://google/<database_name>?cloudSqlInstance=<instance_connection_name>&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=<username>&password=<password>
spring.datasource.username=<username>
spring.datasource.password=<password>
spring.jpa.hibernate.ddl-auto=create
spring.liquibase.enabled=false

(Of course with placeholders replaced by the correct values)

Using the Cloud Shell I was able to connect to the mysql database instance just fine and perform arbitrary operations.

EDIT:
My pom.xml contains the mysql dependency as follows:

<!-- MySQL database support -->
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <scope>runtime</scope>
</dependency>
3
  • The error says it cannot find the driver. Do you have the mysql dependency in your pom.xml or gradle file? Please provide it (the pom og gradle file). Are you building native maybe?
    – grekier
    Commented Apr 20, 2023 at 18:41
  • @grekier: Yes, my pom.xml contains the mysql dependency, it works locally. I'm not building native, just regular Java with maven. I couldn't get GraalVM native compilation to work yet with Spring Boot, either (I'm using Windows). Commented Apr 20, 2023 at 21:21
  • Based on this documentation, double quotes (" ") should not be included. It should be operating_system: ubuntu22 runtime_version: 17
    – Robert G
    Commented Apr 25, 2023 at 13:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.