Will this upgrade work with com.mysql.jdbc.Driver? Because with change in driver ie com.mysql.cj.jdbc.Driver throws could not start container error.
ERROR [main] 0].tryStart(264) | Could not start container
org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:129)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:259)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:212)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:210)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:199)
at com.nexage.nexus.common.BaseNexus_IT.<clinit>(BaseNexus_IT.java:280)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Added below dependency in pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
<scope>test</scope>
</dependency>
in ds.properties file
datasource.name=coreDS
datasource.driver=com.mysql.cj.jdbc.Driver
datasource.url=jdbc:mysql://localhost:18082/core?useSSL=false&requireSSL=false&verifyServerCertificate=false&profileSQL=true&maxQuerySizeToLog=16384&serverTimezone=America/New_York
datasource.username=root
datasource.password=mysql
The code which starts the container:
public static GenericContainer mysqlCore;
mysqlCore = new MySQLImageContainer(testProperties.get("mysql.docker.image").toString())
.withUsername(testProperties.get("db.username").toString())
.withPassword(testProperties.get("db.password").toString())
.withDatabaseName("core");
mysqlCore.setPortBindings(Arrays.asList(testProperties.get("mysql.core.db.port").toString() + ":3306/tcp"));
System.out.println(" starting mysql container");
mysqlCore.start();
The error was resolved by upgrading Test container to 1.14.3 along with new mysql driver and mysql connector 8.0 version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.