Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
I tried to upgrade the kafka testcontainer from 1.19.1 to 1.19.8 in a Spring boot 3 application written in Java 17.
The test compiles and runs fine with version 1.19.1. But after the upgrade, it throws NoClassDefFoundError.
@Testcontainers
@SpringBootTest(classes = KafkaApplication.class)
class KafkaIntegrationTest {
@Container
private static final KafkaContainer KAFKA = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest"));
// Failing in the line above.
}
Relevant log output
java.lang.NoClassDefFoundError: org/testcontainers/containers/ContainerDef
at com.spring.kafka.delay.KafkaIntegrationTest.<clinit>(KafkaIntegrationTest.java:36)
Module
Kafka
Testcontainers version
1.19.8
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host Arch
ARM
Docker version
What happened?
I tried to upgrade the kafka testcontainer from 1.19.1 to 1.19.8 in a Spring boot 3 application written in Java 17. The test compiles and runs fine with version 1.19.1. But after the upgrade, it throws NoClassDefFoundError.
Relevant log output
Additional Information
No response