Task :sonarqube FAILED, Unable to execute SonarScanner analysis

My Jenkins pipeline failed at : ./gradlew sonarqube.

But this command “./gradlew sonarqube” works when i did it on command prompt on another server and the project is created on sonarqube.

But in pipeline when i execute the job it fails.

Please see the pipeline output



Started by user spulber
Obtained Jenkinsfile from git https://github.com/aws4/project1.git
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Project1_Java_Applications
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/Project1_Java_Applications/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/aws4/project1.git # timeout=10
Fetching upstream changes from https://github.com/aws4/project1.git
 > git --version # timeout=10
 > git --version # 'git version 2.17.1'
 > git fetch --tags --progress -- https://github.com/aws4/project1.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/devops^{commit} # timeout=10
Checking out Revision e200db8d2f3a59a14b295ba14888b80a2f763ae9 (refs/remotes/origin/devops)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e200db8d2f3a59a14b295ba14888b80a2f763ae9 # timeout=10
Commit message: "Jenkinsfile Correction"
 > git rev-list --no-walk 272022b2ad9a6f9192b2b0176bc7b3270489240f # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (sonar quality check)
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Project1_Java_Applications@2
[Pipeline] {
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/Project1_Java_Applications@2/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/aws4/project1.git # timeout=10
Fetching upstream changes from https://github.com/aws4/project1.git
 > git --version # timeout=10
 > git --version # 'git version 2.17.1'
 > git fetch --tags --progress -- https://github.com/aws4/project1.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/devops^{commit} # timeout=10
Checking out Revision e200db8d2f3a59a14b295ba14888b80a2f763ae9 (refs/remotes/origin/devops)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e200db8d2f3a59a14b295ba14888b80a2f763ae9 # timeout=10
Commit message: "Jenkinsfile Correction"
[Pipeline] withEnv
[Pipeline] {
[Pipeline] isUnix
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ docker inspect -f . openjdk:11
.
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
$ docker run -t -d -u 111:115 -w /var/lib/jenkins/workspace/Project1_Java_Applications@2 -v /var/lib/jenkins/workspace/Project1_Java_Applications@2:/var/lib/jenkins/workspace/Project1_Java_Applications@2:rw,z -v /var/lib/jenkins/workspace/Project1_Java_Applications@2@tmp:/var/lib/jenkins/workspace/Project1_Java_Applications@2@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** openjdk:11 cat
$ docker top e543b08c52ab4a7ccdf2f5d9c3c01055391c6ba023d92adccc082954e999552f -eo pid,comm
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: sonarqube
[Pipeline] {
[Pipeline] sh
+ chmod +x gradlew
[Pipeline] sh
+ ./gradlew sonarqube -Dsonar.host.url=http://65.0.21.139:9000 -Dsonar.login=******
Starting a Gradle Daemon, 1 incompatible and 3 stopped Daemons could not be reused, use --status for details
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileTestJava UP-TO-DATE
> Task :sonarqube FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> Unable to execute SonarScanner analysis

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.



BUILD FAILED in 8s
4 actionable tasks: 1 executed, 3 up-to-date
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // script
[Pipeline] }
$ docker stop --time=1 e543b08c52ab4a7ccdf2f5d9c3c01055391c6ba023d92adccc082954e999552f
$ docker rm -f e543b08c52ab4a7ccdf2f5d9c3c01055391c6ba023d92adccc082954e999552f
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

Hey there.

In your Pipeline, I would suggest running with increased logging verbosity to see if you can find the true error – as mentioned in the logs you shared.

Thanks colin for you reply.
Please see - ./gradlew sonarqube --debug output


+ ./gradlew sonarqube --debug
2022-06-02T00:05:07.871+0000 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/native
2022-06-02T00:05:07.938+0000 [LIFECYCLE] [org.gradle.launcher.cli.DebugLoggerWarningAction] 
#############################################################################
   WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

   Debug level logging will leak security sensitive information!

   https://docs.gradle.org/7.1.1/userguide/logging.html#sec:debug_security
#############################################################################

2022-06-02T00:05:08.147+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build 7ce35909-71e8-4863-9895-2c58576458b4 in daemon client {pid=30}
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface eth0
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /172.17.0.2
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface lo
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
2022-06-02T00:05:08.152+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
2022-06-02T00:05:08.159+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-06-02T00:05:08.161+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:08.166+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:08.171+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [68a24b51-e6fd-46b8-a592-cbef9ab1df01 port:34461, addresses:[/127.0.0.1]].
2022-06-02T00:05:08.171+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /127.0.0.1.
2022-06-02T00:05:08.175+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Cannot connect to address /127.0.0.1, skipping.
2022-06-02T00:05:08.176+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{pid=63, address=[68a24b51-e6fd-46b8-a592-cbef9ab1df01 port:34461, addresses:[/127.0.0.1]], state=Idle, lastBusy=1654128268216, context=DefaultDaemonContext[uid=c897688e-e9f9-4673-8289-9409326c57c1,javaHome=/usr/local/openjdk-11,daemonRegistryDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon,pid=63,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]}
2022-06-02T00:05:08.176+0000 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Storing daemon stop event with timestamp 1654128308177
2022-06-02T00:05:08.177+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2022-06-02T00:05:08.179+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:08.182+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:08.182+0000 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: [68a24b51-e6fd-46b8-a592-cbef9ab1df01 port:34461, addresses:[/127.0.0.1]]
2022-06-02T00:05:08.182+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2022-06-02T00:05:08.182+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:08.183+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:08.184+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Cannot connect to daemon DaemonInfo{pid=63, address=[68a24b51-e6fd-46b8-a592-cbef9ab1df01 port:34461, addresses:[/127.0.0.1]], state=Idle, lastBusy=1654128268216, context=DefaultDaemonContext[uid=c897688e-e9f9-4673-8289-9409326c57c1,javaHome=/usr/local/openjdk-11,daemonRegistryDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon,pid=63,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]} due to {}. Trying a different daemon...
org.gradle.internal.remote.internal.ConnectException: Could not connect to server [68a24b51-e6fd-46b8-a592-cbef9ab1df01 port:34461, addresses:[/127.0.0.1]]. Tried addresses: [/127.0.0.1].
	at org.gradle.internal.remote.internal.inet.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:67)
	at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToDaemon(DefaultDaemonConnector.java:269)
	at org.gradle.launcher.daemon.client.DefaultDaemonConnector.findConnection(DefaultDaemonConnector.java:201)
	at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToIdleDaemon(DefaultDaemonConnector.java:153)
	at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:120)
	at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:144)
	at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:98)
	at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:57)
	at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:212)
	at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:275)
	at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:247)
	at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:82)
	at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:30)
	at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:92)
	at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:38)
	at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:44)
	at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:26)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:41)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:26)
	at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:240)
	at org.gradle.launcher.Main.doAction(Main.java:35)
	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
	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.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
	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.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:35)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:774)
	at java.base/sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:120)
	at org.gradle.internal.remote.internal.inet.TcpOutgoingConnector.tryConnect(TcpOutgoingConnector.java:81)
	at org.gradle.internal.remote.internal.inet.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:54)
	... 35 more
2022-06-02T00:05:08.184+0000 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Getting daemon stop events
2022-06-02T00:05:08.184+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-06-02T00:05:08.184+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:08.184+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:08.186+0000 [INFO] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing 0 daemon stop events from registry
2022-06-02T00:05:08.186+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2022-06-02T00:05:08.186+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:08.186+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:08.194+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (61) stopped at Wed Jun 01 23:53:18 UTC 2022 by user or operating system
2022-06-02T00:05:08.194+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (62) stopped at Wed Jun 01 23:55:58 UTC 2022 by user or operating system
2022-06-02T00:05:08.194+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (64) stopped at Thu Jun 02 00:03:52 UTC 2022 by user or operating system
2022-06-02T00:05:08.194+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (65) stopped at Thu Jun 02 00:04:26 UTC 2022 by user or operating system
2022-06-02T00:05:08.194+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Previous Daemon (63) stopped at Thu Jun 02 00:05:08 UTC 2022 by user or operating system
2022-06-02T00:05:08.195+0000 [LIFECYCLE] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Starting a Gradle Daemon, 1 incompatible and 5 stopped Daemons could not be reused, use --status for details
2022-06-02T00:05:08.264+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Using daemon args: [/usr/local/openjdk-11/bin/java, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.lang=ALL-UNNAMED, --add-opens, java.base/java.lang.invoke=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.prefs/java.util.prefs=ALL-UNNAMED, --add-opens, java.prefs/java.util.prefs=ALL-UNNAMED, --add-opens, java.base/java.nio.charset=ALL-UNNAMED, --add-opens, java.base/java.net=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent.atomic=ALL-UNNAMED, -XX:MaxMetaspaceSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xms256m, -Xmx512m, -Dfile.encoding=UTF-8, -Duser.country, -Duser.language=en, -Duser.variant, -cp, /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/gradle-7.1.1/lib/gradle-launcher-7.1.1.jar]
2022-06-02T00:05:08.271+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Starting daemon process: workingDir = /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon/7.1.1, daemonArgs: [/usr/local/openjdk-11/bin/java, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.base/java.lang=ALL-UNNAMED, --add-opens, java.base/java.lang.invoke=ALL-UNNAMED, --add-opens, java.base/java.util=ALL-UNNAMED, --add-opens, java.prefs/java.util.prefs=ALL-UNNAMED, --add-opens, java.prefs/java.util.prefs=ALL-UNNAMED, --add-opens, java.base/java.nio.charset=ALL-UNNAMED, --add-opens, java.base/java.net=ALL-UNNAMED, --add-opens, java.base/java.util.concurrent.atomic=ALL-UNNAMED, -XX:MaxMetaspaceSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xms256m, -Xmx512m, -Dfile.encoding=UTF-8, -Duser.country, -Duser.language=en, -Duser.variant, -cp, /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/gradle-7.1.1/lib/gradle-launcher-7.1.1.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 7.1.1]
2022-06-02T00:05:08.313+0000 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'Gradle build daemon'. Working directory: /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon/7.1.1 Command: /usr/local/openjdk-11/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/gradle-7.1.1/lib/gradle-launcher-7.1.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.1.1
2022-06-02T00:05:08.313+0000 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
2022-06-02T00:05:08.315+0000 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: Gradle build daemon.
2022-06-02T00:05:08.343+0000 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
2022-06-02T00:05:08.344+0000 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'Gradle build daemon'
2022-06-02T00:05:08.344+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Gradle daemon process is starting. Waiting for the daemon to detach...
2022-06-02T00:05:08.345+0000 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
2022-06-02T00:05:08.349+0000 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer] Starting consuming the daemon process output.
2022-06-02T00:05:09.755+0000 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer] daemon out: Daemon started. About to close the streams. Daemon details: 0100023633002463333139643938342d316161642d346534632d613236332d333865303834656331396266095b41c0e15a4a4daee49aa4bf73ea80000089e900000001000000047f00000100602f7661722f6c69622f6a656e6b696e732f776f726b73706163652f50726f6a656374315f4a6176615f4170706c69636174696f6e7340322f3f2f2e677261646c652f6461656d6f6e2f372e312e312f6461656d6f6e2d36332e6f75742e6c6f67
2022-06-02T00:05:09.756+0000 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: DETACHED
2022-06-02T00:05:09.757+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Gradle daemon process is now detached.
2022-06-02T00:05:09.757+0000 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle build daemon' finished with exit value 0 (state: DETACHED)
2022-06-02T00:05:09.760+0000 [INFO] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] An attempt to start the daemon took 1.488 secs.
2022-06-02T00:05:09.760+0000 [DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonConnector] Started Gradle daemon DaemonStartupInfo{pid=63, uid=c319d984-1aad-4e4c-a263-38e084ec19bf, address=[095b41c0-e15a-4a4d-aee4-9aa4bf73ea80 port:35305, addresses:[/127.0.0.1]], diagnostics={pid=63, daemonLog=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon/7.1.1/daemon-63.out.log}}
2022-06-02T00:05:09.761+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2022-06-02T00:05:09.761+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-06-02T00:05:09.761+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-06-02T00:05:09.761+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [095b41c0-e15a-4a4d-aee4-9aa4bf73ea80 port:35305, addresses:[/127.0.0.1]].
2022-06-02T00:05:09.761+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /127.0.0.1.
2022-06-02T00:05:09.774+0000 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Connected to address /127.0.0.1:35305.
2022-06-02T00:05:09.791+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Connected to daemon DaemonInfo{pid=63, address=[095b41c0-e15a-4a4d-aee4-9aa4bf73ea80 port:35305, addresses:[/127.0.0.1]], state=Busy, lastBusy=1654128309748, context=DefaultDaemonContext[uid=c319d984-1aad-4e4c-a263-38e084ec19bf,javaHome=/usr/local/openjdk-11,daemonRegistryDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon,pid=63,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=7ce35909-71e8-4863-9895-2c58576458b4, currentDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2}.
2022-06-02T00:05:09.791+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Build
2022-06-02T00:05:09.851+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result org.gradle.launcher.daemon.protocol.BuildStarted@2e2ff723 from daemon DaemonInfo{pid=63, address=[095b41c0-e15a-4a4d-aee4-9aa4bf73ea80 port:35305, addresses:[/127.0.0.1]], state=Busy, lastBusy=1654128309748, context=DefaultDaemonContext[uid=c319d984-1aad-4e4c-a263-38e084ec19bf,javaHome=/usr/local/openjdk-11,daemonRegistryDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon,pid=63,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]} (build should be starting).
2022-06-02T00:05:09.867+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@52ca885b
2022-06-02T00:05:09.867+0000 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 18: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
2022-06-02T00:05:09.867+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 63). The daemon log file: /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon/7.1.1/daemon-63.out.log
2022-06-02T00:05:09.868+0000 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 17: received class org.gradle.launcher.daemon.protocol.CloseInput
2022-06-02T00:05:09.868+0000 [DEBUG] [org.gradle.launcher.daemon.server.DefaultDaemonConnection] thread 17: Received IO message from client: org.gradle.launcher.daemon.protocol.CloseInput@5c5e672c
2022-06-02T00:05:09.869+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting build in new daemon [memory: 512 MiB]
2022-06-02T00:05:09.878+0000 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] Closing daemon's stdin at end of input.
2022-06-02T00:05:09.878+0000 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] The daemon will no longer process any standard input.
2022-06-02T00:05:09.886+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2022-06-02T00:05:09.887+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=c319d984-1aad-4e4c-a263-38e084ec19bf,javaHome=/usr/local/openjdk-11,daemonRegistryDir=/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/daemon,pid=63,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country,-Duser.language=en,-Duser.variant]
2022-06-02T00:05:10.025+0000 [INFO] [org.gradle.internal.work.DefaultWorkerLeaseService] Using 2 worker leases.
2022-06-02T00:05:10.084+0000 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Run build' started
2022-06-02T00:05:10.178+0000 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for file-access, path /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/journal-1/file-access.bin, access org.gradle.cache.internal.DefaultCacheAccess@748efc62
2022-06-02T00:05:10.187+0000 [DEBUG] [org.gradle.cache.internal.DefaultInMemoryCacheDecoratorFactory] Creating in-memory store for cache /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/journal-1/file-access.bin (max size: 4700)
2022-06-02T00:05:10.188+0000 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Acquiring file lock for journal cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/journal-1)
2022-06-02T00:05:10.190+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on journal cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/journal-1).
2022-06-02T00:05:10.190+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on journal cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/journal-1).
2022-06-02T00:05:10.201+0000 [DEBUG] [org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler] Starting file lock listener thread.
2022-06-02T00:05:10.209+0000 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for fileHashes, path /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes/fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@3d1ae6f2
2022-06-02T00:05:10.210+0000 [DEBUG] [org.gradle.cache.internal.DefaultInMemoryCacheDecoratorFactory] Creating in-memory store for cache /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes/fileHashes.bin (max size: 190500)
2022-06-02T00:05:10.210+0000 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Acquiring file lock for file hash cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes)
2022-06-02T00:05:10.211+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on file hash cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes).
2022-06-02T00:05:10.211+0000 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on file hash cache (/var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes).
2022-06-02T00:05:10.273+0000 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for resourceHashesCache, path /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes/resourceHashesCache.bin, access org.gradle.cache.internal.DefaultCacheAccess@3d1ae6f2
2022-06-02T00:05:10.274+0000 [DEBUG] [org.gradle.cache.internal.DefaultInMemoryCacheDecoratorFactory] Creating in-memory store for cache /var/lib/jenkins/workspace/Project1_Java_Applications@2/?/.gradle/caches/7.1.1/fileHashes/resourceHashesCache.bin (max size: 190500)
2022-06-02T00:05:10.739+0000 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for fileHashes, path /var/lib/jenkins/workspace/Project1_Java_Applications@2/.gradle/7.1.1/fileHashes/fileHashes.bin, access 

It looks like Gradle is having difficulty communicating with… itself (SonarQube analysis doesn’t even appear to start).

Is there some networking restrictions possibly happening in the context of your docker image where your build is taking place? If you take Docker out of the equation (running the build locally, for example), does it always work?

Thank you so much colin for your suggestion, that opened my mind. I was stuck at this issue for around one month,
The issue causing the pipeline code was

pipeline{

    agent any


    stages{

        stage("sonar quality check"){

            agent{

                docker{

                    image 'openjdk:11'

                }

            }

            steps{

                script{

                    withSonarQubeEnv(credentialsId: 'sonar-token') {



                        sh 'chmod +x gradlew'

                        sh './gradlew sonarqube'

                    }

                }

            }

        }

    }

}

I have removed the agent : docker from the section and edited the code like below and the code works like a charm.

pipeline{

    agent any

    stages{

        stage("sonar quality check"){

            steps{

                script{

                    withSonarQubeEnv(credentialsId: 'sonar-token') {


                        sh 'chmod +x gradlew'

                        sh './gradlew sonarqube'

                    }

                }

            }

        }

    }

}

Thank u so much Colin