the Jenkins run integration test reported an error and the local test passed. The database script is up to date. Log in to docker to see the latest table
.Error Message
Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
Stacktrace
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: java.net.SocketTimeoutException: connect timed out
Spring Boot"s project, using JPA. On the CI server, use mysql-hprivateAddress-u username-p
to connect to the bridge address of
privateAddress that is the custom of MySQL in docker. show tables
can also see the latest table.
the CI server only installs the official MySQL image that is installed in MySQL client core but not in server,docker.
Spring Boot application.properties
configure related lines
spring.datasource.url=jdbc:mysql://privateAddress:3306/dems?useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=username
spring.datasource.password=password
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=none
I can"t figure out what the problem is.