Hello,
I am currently facing an issue after migrating our application from Spring Boot 1.5.15.RELEASE to 2.6. The migration also included updates to several other key dependencies such as:
- Grails: 3.3.7 → 5.1.9
- Groovy: 2.4.15 → 3.0.9
- Gradle: 3.5 → 7.6.4
- GORM: 6.1.9.RELEASE → 7.2.0
- Micronaut: 3.2.0 added
After successfully compiling the project, the application fails to start and throws a BeanCreationException. Below is the full stack trace:
ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsInterceptorMappedInterceptor': Cannot create inner bean '(inner bean)#39c8101c' of type [org.grails.plugins.web.interceptors.GrailsInterceptorHandlerInterceptorAdapter] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#39c8101c': Unsatisfied dependency expressed through method 'setInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apiAuthInterceptor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'droitUtilisateurService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'droitProfilService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'droitService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initialisationSystemeService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adresseService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thematiqueService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'referentielService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importTalendService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gestionCollectiveService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bulletinService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dossierPaieService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte00Service': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte01Service': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carteService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte02Service': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'etatCivilIndividuService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte9CService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte9GService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'editionMouvementPaieService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte05Service': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carte20Service': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cotisationPSCService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'affiliationService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utilisateurService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailService': Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mailMessageBuilderFactory' defined in grails.plugins.mail.MailConfiguration: Unsatisfied dependency expressed through method 'mailMessageBuilderFactory' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mailMessageContentRenderer' defined in grails.plugins.mail.MailConfiguration: Unsatisfied dependency expressed through method 'mailMessageContentRenderer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Cannot resolve reference to bean 'gspTagLibraryLookup' while setting bean property 'tagLibraryLookup'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'asset.pipeline.grails.AssetsTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetProcessorService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'grailsLinkGenerator': Unsatisfied dependency expressed through field 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsDomainClassMappingContext': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class ogrh.reference.gest.CodeTaux
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
at grails.boot.GrailsApp.run(GrailsApp.groovy:485)
at grails.boot.GrailsApp.run(GrailsApp.groovy:472)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
at ogrh.Application.main(Application.groovy:17)
Relevant Configuration Files
build.gradle: The primary build file contains all dependency configurations and settings. Since the migration, it includes the following updated dependencies:
plugins {
id "groovy"
id "org.grails.grails-web"
id "org.grails.grails-gsp"
id "war"
id "idea"
id "com.bertramlabs.asset-pipeline"
id "application"
id "eclipse"
id "maven-publish"
id "jacoco"
id "org.sonarqube"
id "net.researchgate.release"
id "org.openrewrite.rewrite"
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://repo.spring.io/milestone" }
maven { url 'https://jitpack.io' }
maven {
url "http://nexus.cegape.fr:8081/repository/ogrh/"
allowInsecureProtocol = true
}
}
ext.systemProperties = localBootRunProperties()
group = "ogrh"
configurations.all {
all*.exclude module: 'slf4j-log4j12'
all*.exclude group: "org.bouncycastle", module: "bcprov-jdk16:1.46"
all*.exclude group: "org.bouncycastle", module: "bcprov-jdk15on:1.55"
}
dependencies {
String env = grailsEnv()
implementation platform("org.grails:grails-bom:${grailsVersion}")
implementation platform("io.micronaut:micronaut-bom:$micronautVersion")
implementation("org.grails:grails-core:${grailsVersion}")
implementation("org.hibernate:hibernate-ehcache")
implementation("org.grails:grails-datastore-gorm:${gormVersion}")
implementation("org.codehaus.groovy:groovy-all:${groovyVersion}")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-runtime")
implementation("org.ow2.asm:asm:9.2")
implementation("org.grails:grails-shell:6.1.2")
implementation("org.grails:grails-logging")
implementation("org.grails:grails-plugin-databinding")
implementation("org.grails:grails-plugin-i18n")
implementation("org.grails:grails-plugin-interceptors")
implementation("org.grails:grails-plugin-rest")
implementation("org.grails:grails-plugin-services")
implementation("org.grails:grails-plugin-url-mappings")
implementation("org.grails:grails-web-boot")
implementation("org.grails.plugins:gsp")
implementation("org.grails.plugins:scaffolding")
implementation("org.springframework.hateoas:spring-hateoas:1.5.6")
implementation("org.grails.plugins:spring-security-rest:3.0.1")
implementation("org.grails.plugins:cache:5.0.1")
implementation("org.grails.plugins:async")
implementation("org.grails.plugins:events")
implementation("org.grails.plugins:mail:4.0.0")
implementation("org.grails:grails-datastore-gorm-async:6.1.10.RELEASE")
if (env ==~ /.*ldap/) {
implementation("org.grails.plugins:spring-security-ldap:3.0.2")
// La compilation de cette librairie ne doit pas se faire,sous peine de plantage, si un environnement LDAP n'est pas utilisé
}
if (env ==~ /.*cas/) {
implementation("org.grails.plugins:spring-security-cas:3.1.0")
implementation("org.springframework.security:spring-security-cas:4.1.5.RELEASE")
}
implementation("org.jfree:jcommon:1.0.24")
implementation("xml-apis:xml-apis:1.0.b2")
implementation("jakarta.annotation:jakarta.annotation-api:2.0.0")
implementation("org.jsoup:jsoup:1.14.3")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("com.nimbusds:nimbus-jose-jwt:9.15")
implementation("org.jasypt:jasypt:1.9.3")
implementation("org.grails.plugins:database-migration:4.0.0") {
exclude(module: "bcprov-jdk16:1.46")
exclude group: 'org.liquibase', module: 'liquibase-core'
}
implementation("org.liquibase:liquibase-core:4.6.1")
implementation("javax.xml.bind:jaxb-api:2.3.1")
implementation("com.sun.xml.bind:jaxb-impl:2.3.3")
implementation("com.sun.xml.bind:jaxb-core:3.0.0")
implementation("com.ogrh:import-data:1.3.7.e")
implementation("org.grails.plugins:ajax-tags:1.0.0")
implementation("org.docx4j:docx4j-core:8.1.2")
implementation("org.docx4j:docx4j-export-fo:11.5.0")
implementation("org.docx4j:docx4j-ImportXHTML:11.4.8")
implementation("org.docx4j:xhtmlrenderer:3.0.0")
implementation("org.grails.plugins:excel-import:3.0.2")
implementation("org.grails.plugins:swagger:1.0.1")
implementation("io.swagger:swagger-annotations:1.6.14")
implementation("org.webjars:swagger-ui:5.17.14")
implementation("net.sf.jasperreports:jasperreports:6.4.0")
implementation("net.sf.jasperreports:jasperreports-fonts:6.0.0")
implementation("org.apache.xmlgraphics:batik-bridge:1.17")
implementation("org.apache.xmlgraphics:batik-gvt:1.17")
implementation("org.apache.xmlgraphics:batik-svg-dom:1.17")
implementation("org.apache.xmlgraphics:batik-util:1.17")
implementation("org.apache.xmlgraphics:batik-dom:1.17")
implementation("org.apache.xmlgraphics:batik-script:1.17")
implementation("org.apache.xmlgraphics:batik-css:1.17")
implementation("org.apache.xmlgraphics:batik-awt-util:1.17")
implementation("org.apache.xmlgraphics:batik-svggen:1.17")
implementation("net.sf.opencsv:opencsv:2.3")
implementation("com.itextpdf:itextpdf:5.5.13.4")
implementation("org.apache.logging.log4j:log4j-core:2.17.1")
implementation("org.grails.plugins:grails-xss-sanitizer:1.2.0")
implementation("javax.activation:activation:1.1.1")
implementation("org.glassfish.jaxb:jaxb-runtime:4.0.4")
implementation("com.googlecode.juniversalchardet:juniversalchardet:1.0.3")
implementation("net.sourceforge.htmlunit:htmlunit:2.70.0")
runtimeOnly("org.glassfish.web:el-impl:2.2")
implementation("org.servicestalend.job:ImportXmlRefNomen:0.37.0") {
exclude(group: 'org.slf4j', module: 'slf4j-log4j12')
}
implementation("org.importindividuv2.job:GestionCollIndividu:0.1.0") {
exclude(group: 'org.apache.logging.log4j', module: 'log4j-1.2-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-core')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')
}
implementation("org.importimputbudg.job:JobImportImputationBudgetaire:0.1.0") {
exclude(group: 'org.apache.logging.log4j', module: 'log4j-1.2-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-core')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')
}
implementation("org.importimputbudg.job:JobImportEnMasseNomenclatures:0.1.1") {
exclude(group: 'org.apache.logging.log4j', module: 'log4j-1.2-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-api')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-core')
exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')
}
implementation("org.docx4j:docx4j-JAXB-ReferenceImpl:8.1.2")
implementation("org.grails.plugins:jasypt-encryption:2.0.2")
runtimeOnly("com.h2database:h2")
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
testImplementation("org.grails:grails-gorm-testing-support")
testImplementation("org.grails:grails-web-testing-support")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.grails.plugins:geb:2.0.0")
testRuntimeOnly("org.seleniumhq.selenium:selenium-chrome-driver:4.23.1")
testRuntimeOnly("org.seleniumhq.selenium:selenium-chrome-driver:2.47.1")
console("org.grails:grails-console")
profile("org.grails.profiles:web")
}
java {
sourceCompatibility = JavaVersion.toVersion("11")
}
tasks.withType(Test) {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
}
test {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
ignoreFailures = true
jvmArgs "-Xmx6144m"
maxHeapSize = "6144m"
}
sonarqube {
properties {
property "sonar.sourceEncoding", "UTF-8"
property "sonar.tests", ["src/test", "src/integration-test"]
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportPath", "${buildDir}/jacoco/jacoco.exec"
property 'sonar.jacoco.itReportPath', "${buildDir}/jacoco/integrationTest.exec"
property "sonar.junit.reportsPath", "${project.buildDir}/test-results/test"
}
}
jacoco {
toolVersion = "0.8.8"
reportsDirectory = file("$buildDir/jacoco/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(file("${buildDir}/jacoco/jacocoHtml"))
}
executionData integrationTest, test
}
test {
jacoco {
destinationFile = file("${buildDir}/jacoco/jacoco.exec")
enabled = true
}
}
integrationTest {
jacoco {
destinationFile = file("${buildDir}/jacoco/integrationTest.exec")
enabled = true
}
}
assets {
minifyJs = false
minifyCss = true
}
task dependencyUpdates {
doLast {
gradlew dependencyUpdates
}
}
tasks.withType(JavaCompile) {
options.forkOptions.memoryMaximumSize = '4g'
}
compileGroovy {
groovyOptions.forkOptions.with {
memoryMaximumSize = '4g'
}
}
task pathingMJar(type: Jar) {
archiveAppendix = 'pathing'
doFirst {
def runtimeClasspathFiles = configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.collect { it.file }
def classpathEntries = runtimeClasspathFiles.collect {
it.toURI().toURL().toString().replaceFirst(/file:\/+/, '/')
}.join(' ')
manifest {
attributes "Class-Path": classpathEntries
}
}
// Exclude unnecessary files
exclude { it.file.absolutePath.contains('assetCompile') }
// Ensure this task does not inadvertently cause a circular dependency
onlyIf {
!gradle.taskGraph.hasTask(':compileGroovyPages') && !gradle.taskGraph.hasTask(':compileWebappGroovyPages')
}
}
bootWar {
mainClass.set('ogrh.Application')
enabled = true
}
bootRun {
mainClass.set("ogrh.Application")
jvmArgs "-Xmx4096m"
maxHeapSize = "2048m"
//dependsOn pathingMJar
doFirst {
bootRun.systemProperties(localBootRunProperties())
// Ad d the compiled app classed to the classpath of the pathing jar. Probably there is a gradle variable for them?
classpath = files("$buildDir/classes/main", "$buildDir/resources/main", "$projectDir/gsp-classes") + sourceSets.main.runtimeClasspath
//, pathingMJar.archivePath
//classpath = sourceSets.main.runtimeClasspath + files(pathingMJar.archivePath)
//classpath = files("$buildDir/classes/groovy/main", "$buildDir/resources/main") + sourceSets.main.runtimeClasspath + files(pathingMJar.archivePath)
}
}
/*[dbmGormDiff, dbmClearChecksums, dbmGenerateChangelog, dbmGenerateGormChangelog].each { runTask ->
configure(runTask) {
systemProperties localBootRunProperties()
}
}*/
grails {
//pathingJar = true
agent {
enabled = true
}
}
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
publishing {
publications {
webApp(MavenPublication) {
artifactId 'war'
from components.web
}
}
repositories {
maven {
name 'nexus'
url nexusReleaseUrl
credentials {
username = nexusUser
password = nexusPassword
}
}
}
}
release {
failOnCommitNeeded = true
failOnPublishNeeded = true
failOnUnversionedFiles = true
failOnSnapshotDependencies = false
failOnUpdateNeeded = true
revertOnFail = true
preCommitText = ''
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = '${version}'
versionPropertyFile = 'gradle.properties'
versionProperties = []
buildTasks = ['build']
scmAdapters = [
net.researchgate.release.GitAdapter,
]
git {
requireBranch = 'master'
pushToRemote = 'origin'
pushToBranchPrefix = ''
commitVersionFileOnly = false
signTag = false
}
}
war {
rootSpec.exclude("bcprov-jdk16-1.46.jar")
rootSpec.exclude("bcprov-jdk15on-1.55.jar")
String env = grailsEnv()
if (env == "ldap") {
rootSpec.exclude 'application.yml'
rootSpec.exclude 'application-cas.yml'
} else if (env == "cas") {
rootSpec.exclude 'application.yml'
rootSpec.exclude 'application-ldap.yml'
} else {
rootSpec.exclude 'application-ldap.yml'
rootSpec.exclude 'application-cas.yml'
}
}
String grailsEnv() {
Properties p = ext.systemProperties
String env = p.getProperty('grails.env')
env
}
Properties localBootRunProperties() {
Properties p = new Properties()
p.load(new FileInputStream(
file(project.projectDir).absolutePath + "/grails-app/conf/config/contexts/database.properties"))
return p
}
jar {
enabled = true
}
bootJar {
enabled = false
}
gradle.properties :
grailsVersion=5.1.9
grailsGradlePluginVersion=5.1.5
groovyVersion=3.0.9
gormVersion=7.2.0
micronautVersion=3.2.0
logback.version=1.2.7
version=0.14.0.0-SNAPSHOT
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx6144m
Comment From: bclozel
Sorry but we won't be able to help you as Spring Boot 2.6 is out of support.