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>
pom.xml
contains themysql
dependency, it works locally. I'm not building native, just regular Java withmaven
. I couldn't getGraalVM
native compilation to work yet withSpring Boot
, either (I'm usingWindows
)." "
) should not be included. It should beoperating_system: ubuntu22 runtime_version: 17