Community Edition - cannot restart SonarQube after stopping process

I am new to SoanrQube and I appreciate any help with this topic.

I am using a local instance of SonarQube Community Edition 8.8 on Windows. It was working fine when I first started. I stopped the process in Windows Command Prompt (I hit Ctrl + C) so I could connect it to my local database in MSSQL. But I couldn’t restart SonarQube again. I’m trying to execute C:\sonarqube\bin\windows-x86-64\StartSonar.bat.

Things I’ve tried:

  • Comment out sonar.jdbc.url in sonar.properties so I can use the embedded database instead of MSSQL.
  • Ending all Java and Command Prompt processes in Task Manager.
  • Logs said Elasticsearch was trying to use port 9002. I tried changing sonar.search.port, but logs still say it’s trying to use port 9002 even though I saved my changes to the sonar.properties file.
  • Running netstat -abno in Windows Command Prompt and looking for anything listening on 127.0.0.1:9000, 127.0.0.1:9001, 127.0.0.1:9002. Nothing is listening on these ports.
  • Restarting my computer and running StartSonar.bat again. Getting the same errors.
  • Deleting my local instance of SonarQube and downloading again. Logs show Elasticsearch is listening on port 9002 even though I haven’t modified sonar.properties for this new download.

Sonar logs

Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2021.04.14 11:16:51 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube\temp
2021.04.14 11:16:51 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9002, TCP: 127.0.0.1:54280]
2021.04.14 11:16:51 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [C:\sonarqube\elasticsearch]: C:\Program Files\Java\jdk-11.0.10\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.io.tmpdir=C:\sonarqube\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.locale.providers=COMPAT -Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\sonarqube\elasticsearch -Des.path.conf=C:\sonarqube\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2021.04.14 11:16:51 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2021.04.14 11:17:00 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2021.04.14 11:17:00 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [C:\sonarqube]: C:\Program Files\Java\jdk-11.0.10\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube\temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*;C:\sonarqube\lib\jdbc\h2\h2-1.4.199.jar org.sonar.server.app.WebServer C:\sonarqube\temp\sq-process15582090671430102219properties
2021.04.14 11:17:01 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2021.04.14 11:17:01 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2021.04.14 11:17:01 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

ES logs

2021.04.14 11:16:54 INFO  es[][o.e.n.Node] JVM home [C:\Program Files\Java\jdk-11.0.10]
2021.04.14 11:16:54 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=C:\sonarqube\temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=COMPAT, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Delasticsearch, -Des.path.home=C:\sonarqube\elasticsearch, -Des.path.conf=C:\sonarqube\temp\conf\es]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2021.04.14 11:16:54 INFO  es[][o.e.p.PluginsService] no plugins loaded
2021.04.14 11:16:54 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[OS (C:)]], net usable_space [272.1gb], net total_space [475.6gb], types [NTFS]
2021.04.14 11:16:54 INFO  es[][o.e.e.NodeEnvironment] heap size [494.9mb], compressed ordinary object pointers [true]
2021.04.14 11:16:54 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [q9WJQr6JQvGSTZE5VZBgZA], cluster name [sonarqube], roles [master, remote_cluster_client, data, ingest]
2021.04.14 11:16:57 INFO  es[][o.e.t.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=1mb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=false, g1gc_region_size=0b, heap_size=494.9mb}]
2021.04.14 11:16:57 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2021.04.14 11:16:57 INFO  es[][o.e.g.DanglingIndicesState] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
2021.04.14 11:16:57 INFO  es[][o.e.n.Node] initialized
2021.04.14 11:16:57 INFO  es[][o.e.n.Node] starting ...
2021.04.14 11:16:58 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:54280}, bound_addresses {127.0.0.1:54280}
2021.04.14 11:16:58 INFO  es[][o.e.c.c.Coordinator] cluster UUID [PfplzGe0SqikfsQ273UFDg]
2021.04.14 11:16:58 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{q9WJQr6JQvGSTZE5VZBgZA}{JvEad5MmQfe-ot4Je-qP7w}{127.0.0.1}{127.0.0.1:54280}{dimr}{rack_id=sonarqube} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 27, version: 523, delta: master node changed {previous [], current [{sonarqube}{q9WJQr6JQvGSTZE5VZBgZA}{JvEad5MmQfe-ot4Je-qP7w}{127.0.0.1}{127.0.0.1:54280}{dimr}{rack_id=sonarqube}]}
2021.04.14 11:16:58 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{q9WJQr6JQvGSTZE5VZBgZA}{JvEad5MmQfe-ot4Je-qP7w}{127.0.0.1}{127.0.0.1:54280}{dimr}{rack_id=sonarqube}]}, term: 27, version: 523, reason: Publication{term=27, version=523}
2021.04.14 11:16:58 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9002}, bound_addresses {127.0.0.1:9002}
2021.04.14 11:16:58 INFO  es[][o.e.n.Node] started
2021.04.14 11:16:58 INFO  es[][o.e.g.GatewayService] recovered [7] indices into cluster_state
2021.04.14 11:16:59 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[components][0]]]).

Web logs

2021.04.14 11:17:01 ERROR web[][o.a.c.c.StandardService] Failed to initialize connector [Connector[HTTP/1.1-9002]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:1077)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
	at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:72)
	at org.sonar.server.app.WebServer.start(WebServer.java:52)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
	at org.sonar.server.app.WebServer.main(WebServer.java:99)
Caused by: java.net.BindException: Address already in use: bind
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:455)
	at java.base/sun.nio.ch.Net.bind(Net.java:447)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
	at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:222)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1143)
	at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:222)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:599)
	at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:80)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:1075)
	... 12 common frames omitted
2021.04.14 11:17:01 ERROR web[][o.s.s.a.EmbeddedTomcat] Fail to start web server
org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9002]]
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
	at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:72)
	at org.sonar.server.app.WebServer.start(WebServer.java:52)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
	at org.sonar.server.app.WebServer.main(WebServer.java:99)
2021.04.14 11:17:01 WARN  web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9002]]
	at com.google.common.base.Throwables.propagate(Throwables.java:241)
	at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:77)
	at org.sonar.server.app.WebServer.start(WebServer.java:52)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
	at org.sonar.server.app.WebServer.main(WebServer.java:99)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9002]]
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:846)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
	at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:72)
	... 4 common frames omitted
2021.04.14 11:17:01 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Hi,

Welcome to the community and kudos on both checking and including (code-formatted, no less!!) your logs!

web.log tells the tale:

When you shut down the first time, it wasn’t clean; not all the processes stopped & released their ports. I’m not conversant with the best way to find and kill errant threads on Windows, but that’s what you need to do.

 
HTH!
Ann

Hi, Ann,

Thanks for replying. I did see that about address already in use. I thought Ctrl+C was a clean shut down? I’ve tried restarting and shutting down my computer.

Would changing sonar.search.port in sonar.properties make any difference? I tried changing the port but it didn’t seem to take effect.

Hi,

At this point I’m not sure how you started SonarQube, but there’s a start script to do that… and a ‘stop’ script to shut it down gracefully.

You can edit config to change the ports each time. That will work until you run out of ports. :smile:

 
Ann

I was using StartSonar.bat to try a local instance of SonarQube and following the instructions in Try Out SonarQube in the docs. I didn’t use the StartNTService.bat or StopNTService.bat.

I killed all Java processes in Task Manager.

Like I said, editing my sonar.properties didn’t make a difference. Elasticsearch was still trying to listen on port 9002. I even tried deleting my whole installation of SoanrQube and it would still try to listen on port 9002 even though I had not changed sonar.properties.

So this seemed to have resolved on its own…This has been a weird experience.

I even created a new local instance of SonarQube in a completely different folder on my C drive. For some reason, it was which was picking up the properties for my older SonarQube instance when I ran it in CommandPrompt (I definitely had the correct path to StartSonar.bat). I was expecting the new instance to throw an error about java since the wrapper.conf wasn’t even mapped correctly to it.

Just…weird.

I’ll be closing this question.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.