gradle bootRun starts successfully but disconnects after some time

444 views Asked by At
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:470)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.writeWithNonBlockingRetry(SocketConnection.java:259)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.writeBufferToChannel(SocketConnection.java:247)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketOutputStream.flush(SocketConnection.java:241)
at org.gradle.internal.remote.internal.inet.SocketConnection.flush(SocketConnection.java:119)
... 22 more
Daemon vm is shutting down... The daemon has exited normally or was terminated in response to a user interrupt.
:bootRun FAILED

I have used

server.connection-timeout=-1 

in application.properties but it still disconnects after some time.

I even used

spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1

in application.properties but to no avail. What I'm I doing wrong?

1

There are 1 answers

0
Rbk On

I had to change

spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1

to

spring.datasource.dbcp.test-while-idle=true spring.datasource.dbcp.validation-query=SELECT 1

Apparently there had been a renaming in springboot 1.4.