Spring boot gradle plugin not working - java

I have a problem where my spring boot project runs fine, but i cant run a gradle build, debug or build a war or anything.
I get the following stacktrace in my error report:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'thetenticle.api'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:466)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:78)
at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:130)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:442)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:437)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:40)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:63)
at org.gradle.tooling.internal.provider.DelegatingBuildModelAction.run(DelegatingBuildModelAction.java:44)
at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:98)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:70)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:68)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:68)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:59)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:126)
at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:48)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskContainer.create(Ljava/lang/String;Ljava/lang/Class;)Lorg/gradle/api/Task;
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures.addRepackageTask(RepackagePluginFeatures.java:61)
at org.springframework.boot.gradle.repackage.RepackagePluginFeatures.apply(RepackagePluginFeatures.java:56)
at org.springframework.boot.gradle.SpringBootPlugin.apply(SpringBootPlugin.java:45)
at org.springframework.boot.gradle.SpringBootPlugin.apply(SpringBootPlugin.java:38)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:107)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:71)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:854)
at org.gradle.api.Project$apply.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply.callCurrent(Unknown Source)
at build_29m6desjd64mvpujgjg1iamv4j.run(/home/glagnar/workspace/api.thetenticle/build.gradle:16)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
... 55 more
My gradle.build file looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
repositories {
mavenCentral()
maven { url 'http://maven.springframework.org/release' }
maven { url 'http://maven.springframework.org/milestone' }
maven { url 'http://maven.springframework.org/snapshot' }
maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
maven { url 'http://download.java.net/maven/2' }
}
jar {
baseName = 'thetenticle.api'
version = '0.1.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
//compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("mysql:mysql-connector-java:5.1.34")
compile('org.springframework.boot:spring-boot-starter-aop')
compile("org.springframework.boot:spring-boot-starter-hateoas")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("com.h2database:h2")
compile('org.mockito:mockito-core:1.9.5')
testCompile group: 'junit', name: 'junit', version: '4.11'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.3.5'
}
Ive searched alot but found no good solution.

The version of Gradle that you're using doesn't meet Spring Boot 1.3.5's requirements:
Spring Boot is compatible with Gradle 1.12 or above
I'd recommend using 2.14 which, at the time of writing, is the latest stable release.

Related

Gradle multimodule project - how to create library with individual module as dependency jar

Below is my multimodule project setup.
Root project 'gradle-lib'
+--- Project ':environment-config1'
+--- Project ':environment-config2'
+--- Project ':environment-api'
\--- Project ':environment-lib'
gradle-lib/build.gradle
plugins {
id "org.springframework.boot" version "2.6.7" apply false
id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false
}
subprojects { final Project subproject ->
apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
version = rootProject.version
group = rootProject.group
repositories {
mavenLocal()
mavenCentral()
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
// No spring boot application
bootJar {
enabled = false
}
jar {
enabled = true
// Remove `plain` postfix from jar file name
archiveClassifier.set("")
}
sourceCompatibility = '1.8'
// Add dependencies that common to all projects
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
environment-config1/build.gradle
dependencies {
implementation project(":environment-api")
}
environment-config2/build.gradle
dependencies {
implementation project(":environment-api")
}
environment-api/build.gradle
// Boiler plate code with some jar dependencies
dependencies {
}
environment-lib/build.gradle
dependencies {
implementation project(":environment-api")
implementation project(":environment-config1")
implementation project(":environment-config2")
}
Whenever I try to build this project with gradlew clean build, these is compileJava task failed at 'environment-lib' which actually uses certain class files from environment-config1 & environment-api projects.
I could suppress the same as below, but what configuration: 'default' will do?
implementation project(":environment-api", configuration: 'default')
implementation project(":environment-config1", configuration: 'default')
implementation project(":environment-config2", configuration: 'default')
How can I create a single jar with other module as individual jar like below. Is it possible or recommended way?
gradle-lib-1.0.0.jar ---> + META-INF
\- MANIFEST.MF
+ //source files of environment-lib project
+ lib
\- environment-api-1.0.0.jar
\- environment-config1-1.0.0.jar
\- environment-config2-1.0.0.jar

Gradle Kotlin Plugin Breaking Project

I have inherited legacy code. It is a multi-project repository using the Gradle build tool, mostly written in Java w/ SpringBoot and some Kotlin mixed in.
I fixed a bug in one of the repository's sub-projects, but when I made those changes one of the other sub-projects that I hadn't touched broke the build. The issue seems to be related to the version of my Gradle Kotlin Plugin. I do not know how to get this building again.
This is the stacktrace when I run gradle clean build:
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':capacity-exchange'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:59)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:504)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:83)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.NoSuchMethodError: org.gradle.api.artifacts.Configuration.defaultDependencies(Lorg/gradle/api/Action;)Lorg/gradle/api/artifacts/Configuration;
at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:51)
at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:39)
at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:188)
at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:137)
at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:103)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:115)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:131)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:37)
at org.gradle.api.Project$apply$0.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_2x3w9v5cmg28ubbebxufvvzdr.run(/mnt/c/Users/tparrotte/Workspace/pjm_scripts/capacity-exchange/build.gradle:16)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
... 32 more
This is the build.gradle file for the capacity-exchange project that is giving the error:
buildscript {
ext {
kotlinVersion = '1.2.71'
springBootVersion = '2.1.1.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.companyname.capacityexchange'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
runtime 'mysql:mysql-connector-java:5.1.46'
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
Any help on resolving my build issue would be greatly appreciated.
This issue was caused by production using Gradle 4.10.2 but my development environment using Gradle 6.x.

org.springframework.boot Configuration with name 'runtime' not found

When trying to run my program using gradle bootRun, the error shows that
Failed to apply plugin 'org.springframework.boot'
Configuration with name 'runtime' not found
The following is my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
}
}
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
jar {
baseName = 'blockchain-demo'
version = '0.0.1'
}
war {
baseName = 'blockchain-demo'
version = '0.0.1'
}
application {
mainClass = 'web.Application'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-devtools")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
I assume you're using Gradle 7. In Gradle 7, the configurations compile, testCompile, runtime and testRuntime have been removed in favor of implementation, testImplementation, runtimeOnly and testRuntimeOnly. That's why Gradle issues
Failed to apply plugin 'org.springframework.boot' Configuration with name 'runtime' not found
To fix the issue, you should use the Gradle version that is supported by the Spring Boot Gradle Plugin version you're using (1.5.3, according to the snippet provided). The system requirements lists Gradle version 2 and 3 as requirement for Spring Boot 1.5.3. Everything thereafter is not supported.
Spring Boot 2.5.0 supports Gradle 6.8, 6.9, or 7.x
See here for a good reference on Gradle 7 configurations: https://docs.spring.io/spring-boot/docs/2.5.0/gradle-plugin/reference/htmlsingle/
This will get you off the ground:
plugins {
id 'org.springframework.boot' version '2.5.0'
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
}
repositories {
mavenCentral()
}

SSL ProtocolException on Java 11

I have recently migrated my springboot application from Springboot 1, Java 8 to Spring boot 2, Java 11. This was working fine on 8 so far.
This springboot application is a cron job which runs daily and processes thousands of records.
For each record this application calls another app to retrieve some response (both apps are running on Java 11).
The strange thing is I am getting this exception only while processing few records (say about 100s) rest works fine.
Below is the exception stacktrace:
javax.net.ssl.SSLProtocolException: Connection reset
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
at java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1314)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:839)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:153)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.win.billpayalerts.service.EcmService.getEcmInfoWithRetryCount(EcmService.java:171)
at com.win.billpayalerts.service.EcmService.getEcmAccountInfoByEcmContactId(EcmService.java:91)
at com.win.billpayalerts.service.EcmService.getEcmAccountInfoByEcmContactId(EcmService.java:362)
at com.win.billpayalerts.service.AlertService.getEcmInfoForCustomer(AlertService.java:233)
at com.win.billpayalerts.service.InvoiceAlertProcessor.processInvoice(InvoiceAlertProcessor.java:48)
at com.win.billpayalerts.service.AlertProcessor.invokeNotificationAlert(AlertProcessor.java:70)
at com.win.billpayalerts.service.AlertProcessor.run(AlertProcessor.java:44)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202)
at com.win.billpayalerts.BillpayAlertsApplication.main(BillpayAlertsApplication.java:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:86)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:448)
at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68)
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1104)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:823)
... 39 common frames omitted
This is the gradle file of the source application:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'jdepend'
sourceCompatibility = 1.11
targetCompatibility = 1.11
bootJar {
archiveBaseName = 'alerts'
}
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-mail')
compile("org.apache.axis:axis:1.4")
compile('org.apache.commons:commons-lang3:3.5')
compile('org.apache.httpcomponents:httpclient:4.3.4')
compile('org.apache.pdfbox:pdfbox:2.0.1')
compile("net.sf.ehcache:ehcache:2.10.3")
compile("commons-discovery:commons-discovery:0.5")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.8.4")
compile('ch.qos.logback:logback-core:1.1.8')
compile('ch.qos.logback:logback-classic:1.1.8')
compile("wsdl4j:wsdl4j:1.6.2")
runtime('com.microsoft:sqljdbc4:4.0')
testRuntime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile group: 'junit', name: 'junit', version: '4.4'
}
This is the gradle file of the another application:
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'jdepend'
sourceCompatibility = 1.11
bootJar {
baseName = 'accounts'
}
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-cache')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-mail')
compile("io.springfox:springfox-swagger2:2.7.0")
compile("io.springfox:springfox-swagger-ui:2.7.0")
compile('org.springframework.boot:spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('org.apache.commons:commons-lang3:3.5')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.apache.commons:commons-collections4:4.0')
compile group: 'net.sf.jt400', name: 'jt400-jdk8', version: '9.5'
compile('org.apache.httpcomponents:httpclient:4.3.4')
compile('log4j:log4j:1.2.17')
compile('org.projectlombok:lombok')
runtime('com.microsoft:sqljdbc4:4.0')
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testCompile group: 'junit', name: 'junit'
}
I tried by disabling TLSv1.3 via the JVM argument but that did not work:
-Djdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
How do I resolve this issue? Thanks in advance.
Not really an answer, more a suspicion, and too long for a comment:
Since you're getting Connection reset, and not Connection reset by peer, I suspect the reset is done by the java application itself or the server it's running on. I looked at the source code for SocketInputStream.read. It's reading based on a timeout value:
try {
n = socketRead(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
} catch (ConnectionResetException rstExc) {
impl.setConnectionReset();
} finally {
impl.releaseFD();
}
My guess is that the ConnectionResetException is thrown due to a reset from the server, that also sets the value of the timeout (on the connection, not the read).
I don't know if you have logs of the records with success along with those that failed, but if you do, maybe you can check timestamps to see if my suspicions are heading the right way.

Gradle couldn't locate the Spring core jar

i am spring boot using gradle build. till yesterday gradle build was run smoothly. But today i got this following error ;
Could not resolve all artifacts for configuration ':classpath'.
Could not find spring-core.jar (org.springframework:spring-core:5.2.0.BUILD-SNAPSHOT:20190328.215418-203).
Searched in the following locations:
https://repo.spring.io/snapshot/org/springframework/spring-core/5.2.0.BUILD-SNAPSHOT/spring-core-5.2.0.BUILD-20190327.205120-195.jar
Could not find spring-jcl.jar (org.springframework:spring-jcl:5.2.0.BUILD-SNAPSHOT:20190328.215418-203).
Searched in the following locations:
https://repo.spring.io/snapshot/org/springframework/spring-jcl/5.2.0.BUILD-SNAPSHOT/spring-jcl-5.2.0.BUILD-20190327.205120-195.jar
this is my build.gradle file
buildscript {
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
maven {url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE")
}
}
plugins {
id 'org.springframework.boot' version '2.2.0.BUILD-SNAPSHOT'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
group = 'me.namila'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
jcenter()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
When visiting the relevant url,what i can see is gradle is searching for 27th march build (spring-jcl-5.2.0.BUILD-20190327.205120-195.jar) while the server has the 28th build spring-jcl-5.2.0.BUILD-20190328.164750-201.jar. how to fix this error? i have added buildscript repositories too. any suggesions?
As Antoniossss said in the comments, this happened because snapshot build failure. To fix it i moved to previous build version of springboot. i did the following changes to the build.gradle file;
id 'org.springframework.boot' version '2.1.3.RELEASE'
changed the '2.2.0.BUILD-SNAPSHOT' to 2.1.3 release. this fixed the error. :)
the buildscript repositories & dependencies are a mess, there's a mismatch:
buildscript {
repositories {
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.2.0.BUILD-SNAPSHOT'
}
}
apply plugin: 'org.springframework.boot'
see the documentation.

Categories

Resources