My dependencies:
buildscript {
ext {
LOMBOK_VERSION = '1.18.22'
SLF4J_VERSION = '1.7.30'
SPRING_BOOT_VERSION = "2.6.6"
SPRING_RETRY_VERSION = "1.3.1"
JUNIT_JUPITER_VERSION = "5.8.2"
MOCKITO_JUNIT_JUPITER_VERSION = "4.3.1"
MSSQL_JDBC_VERSION = "9.4.1.jre11"
LOGSTASH_LOGBACK_ENCODER_VERSION = "7.2"
TESTCONTAINERS_VERSION = "1.17.6"
WIREMOCK_VERSION = "2.27.2"
TEST_GSON_VERSION = "2.10"
}
}
plugins {
id 'java'
id "org.springframework.boot" version "${SPRING_BOOT_VERSION}"
}
springBoot {
buildInfo()
}
repositories {
maven {
url = 'xxx'
}
}
dependencies {
// As this whole project is a test, I´m including everything as implementation
implementation "org.springframework.boot:spring-boot-starter:${SPRING_BOOT_VERSION}"
implementation "net.logstash.logback:logstash-logback-encoder:${LOGSTASH_LOGBACK_ENCODER_VERSION}"
implementation 'com.microsoft.sqlserver:mssql-jdbc:12.2.0.jre11'
implementation "org.springframework.boot:spring-boot-starter-test:${SPRING_BOOT_VERSION}"
implementation "org.testcontainers:testcontainers:${TESTCONTAINERS_VERSION}"
implementation "org.testcontainers:junit-jupiter:${TESTCONTAINERS_VERSION}"
implementation "com.google.code.gson:gson:${TEST_GSON_VERSION}"
testImplementation "com.github.tomakehurst:wiremock:${WIREMOCK_VERSION}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}"
testImplementation "org.mockito:mockito-junit-jupiter:${MOCKITO_JUNIT_JUPITER_VERSION}"
}
test {
useJUnitPlatform()
}
My error:
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jettyWebServerFactoryCustomizer' defined in class path resource [org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration$JettyWebServerFactoryCustomizerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.web.embedded.JettyWebServerFactoryCustomizer]: Factory method 'jettyWebServerFactoryCustomizer' threw exception; nested exception is java.lang.NoClassDefFoundError: org/eclipse/jetty/server/RequestLog$Writer
at app//org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163)
at app//org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
at app//org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at app//org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
at app//org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
at app//org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at app//org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:136)
at app//org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at app//org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
i got this error when i added the WIremock
dependency
I changed the wiremock version to 3.0.0-beta-2