I have upgraded my Springboot gradle application to 2.7.1 to 3.2.3.
My all applications will run as Windows wrapper services. Before the upgrade everything working fine. after the upgrade, when I started my Windows service giving an attached issue. but when I use Springboot 3.1.9 or below versions it works fine.
Note: It is working fine in Intellij and running as a jar in windows server also working fine. but not as a windows service.
Windows wrapper XML code:
<service>
<id>serviceID</id>
<name>name</name>
<description>description</description>
<executable>%JAVA_HOME%\bin\java</executable>
<arguments>-Dname=(xxxxxxxxxxx-serviceid) -Xmx2048M -cp .\* org.springframework.boot.loader.JarLauncher</arguments>
<logmode>none</logmode>
<logpath>%BASE%\logs</logpath>
<startmode>Automatic</startmode>
</service>
My build.gradle file
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
import java.util.concurrent.TimeUnit
plugins {
id "org.springframework.boot" version "3.2.3"
id "io.spring.dependency-management" version "1.1.4"
id "java"
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "2.1.2"
id "com.jfrog.artifactory" version "5.2.0"
id "org.gradle.maven-publish"
id "org.sonarqube" version "5.0.0.4638"
id "com.gorylenko.gradle-git-properties" version "2.4.1"
}
group = "xxxxxxxx"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven {
url = uri("${project.property("artifactory_contextUrl")}/${project.property("artifactory_resolve_repository")}")
credentials {
username "$artifactory_user"
password "$artifactory_password"
}
}
}
springBoot {
buildInfo()
}
ext {
springCloudVersion = "2023.0.1"
springBootAdminVersion = "3.2.3"
}
configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
}
}
dependencies {
annotationProcessor'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.springframework.boot:spring-boot-starter-integration'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.integration:spring-integration-http'
// https://mvnrepository.com/artifact/org.springframework.integration/spring-integration-ip
implementation 'org.springframework.integration:spring-integration-ip:6.2.3'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.integration:spring-integration-test'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.core:jackson-annotations'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
implementation 'com.lmax:disruptor:3.4.3'
implementation 'com.google.guava:guava:32.0.0-jre'
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'io.zipkin.brave:brave:5.13.0'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
// spring XML encrypt
implementation 'com.github.ulisesbocchio:jasypt-spring-boot:3.0.5'
// https://mvnrepository.com/artifact/org.modelmapper/modelmapper
implementation 'org.modelmapper:modelmapper:3.2.0'
{
changing(true)
}
implementation 'de.codecentric:spring-boot-admin-starter-client'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.integration:spring-integration-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation('com.querydsl:querydsl-mongodb') {
exclude group: 'org.mongodb', module: 'mongo-java-driver'
}
// test
/* testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'*/
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "de.codecentric:spring-boot-admin-dependencies:${springBootAdminVersion}"
}
}
// default bootJar task
tasks.named("bootJar") {
enabled = true
}
// rename -plain to -lib jar
tasks.named("jar") {
archiveClassifier.set("lib")
enabled = true
}
// add test task
tasks.named("test") {
//useJUnitPlatform()
}
// add task to manage change log
/*tasks.register("generateGitChangelog", GitChangelogTask) {
fromRepo = "$projectDir"
file = file("CHANGELOG.md")
untaggedName = "${project.version}"
ignoreCommitsIfMessageMatches = ".*\\[skip ci\\].*"
}*/
// allows publication of maven artifacts by artifactory
publishing {
publications {
mavenJava(MavenPublication) {
artifact(tasks.getByName("jar"))
}
}
}
// allows publication and resolution of artifacts to and from artifactory
artifactory {
contextUrl = "${project.property("artifactory_contextUrl")}"
publish {
clientConfig.setIncludeEnvVars(true)
repository {
repoKey = "${project.property("artifactory_publish_repository")}"
username = "${project.property("artifactory_user")}"
password = "${project.property("artifactory_password")}"
//maven = true
}
defaults {
publications("mavenJava")
publishArtifacts = true
publishPom = true
}
}
/* resolve {
repository {
repoKey = "${project.property("artifactory_publish_repository")}"
username = "${project.property("artifactory_user")}"
password = "${project.property("artifactory_password")}"
maven = true
}
}*/
}
Comment From: scottfrederick
@rajuperala91 Thanks for getting in touch. Can you get the logs from the application when it is run was a service and share those?
Comment From: rajuperala91
Logs also not generating. When i start the application service showing attached issue.
Comment From: scottfrederick
@rajuperala91 The Spring Boot 3.2 release notes includes information about changes to the nested jar support. You should either change the launcher in your wrapper XML from org.springframework.boot.loader.JarLauncher to org.springframework.boot.loader.launch.JarLauncher, or leave it as-is and set the loaderImplementation to CLASSIC in your build configuration.
Comment From: rajuperala91
Now the application is up and running. modified this org.springframework.boot.loader.JarLauncher to org.springframework.boot.loader.launch.JarLauncher . Thank you so much for the quick help.