Error Starting ZooKeeper Server: "Address Already in Use"

Engine start-up fails after running the start.sh|bat script. Although port 2181 is free

While attempting to start the ZooKeeper server using the start.bat command with the -p <password> -s all,

2024-11-14 15:51:17,675 [myid:] - INFO [main:o.a.z.s.q.QuorumPeerConfig@177] - Reading configuration from: C:\appian243\appian\services\conf\zookeeper.properties
...
2024-11-14 15:51:18,707 [myid:0] - INFO [main:o.a.z.s.NIOServerCnxnFactory@660] - binding to port 0.0.0.0/0.0.0.0:2181
2024-11-14 15:51:18,711 [myid:0] - ERROR [main:o.a.z.s.ZooKeeperServerMain@91] - Unexpected exception, exiting abnormally
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:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:81)
at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:662)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:160)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:113)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:68)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:141)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91)
2024-11-14 15:51:18,713 [myid:0] - INFO [main:o.a.z.a.ZKAuditProvider@42] - ZooKeeper audit is disabled.
2024-11-14 15:51:18,717 [myid:0] - ERROR [main:o.a.z.u.ServiceUtils@48] - Exiting JVM with code 1

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    It seems the ZooKeeper instance may not have shut down properly, or another process might be using the port. Please check if there's an active ZooKeeper process running and, if possible, shut it down. If necessary, you can kill the process[not recommended use it if no other option is working ]and try restarting ZooKeeper.

  • Stop all services (stop.sh -p <Password> -all) and check the status when finished (status.sh )

    After all, try to start again. If you still get the same error, check the topology file to see if you are starting the services on the same port as the one you can see in the error log

  • Kafka is continuously waiting to start, but the process isnt moving forward.

    Any insights or suggestions on how to resolve this?


    Detected Appian version 24.3.476.0 from build.info
    Starting Distributed Transaction Log services: [all]
    Executing command: '[cmd, /c, start, "Zookeeper", /min, "%JAVA_HOME%\bin\java.exe", -Xms128m, -Xmx256m, -Dzookeeper.log.dir=C:\Program Files\Appian\logs\service-manager\zookeeper, -Duser.timezone=GMT, -cp, C:\Program Files\Appian\services\zookeeper-3.8.4\lib\zookeeper-prometheus-metrics-3.8.4.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\zookeeper-jute-3.8.4.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\zookeeper-3.8.4.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\snappy-java-1.1.10.5.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\slf4j-api-1.7.30.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\simpleclient_servlet-0.9.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\simpleclient_hotspot-0.9.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\simpleclient_common-0.9.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\simpleclient-0.9.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-transport-native-unix-common-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-transport-native-epoll-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-transport-classes-epoll-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-transport-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-resolver-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-handler-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-common-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-codec-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\netty-buffer-4.1.105.Final.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\metrics-core-4.1.12.1.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\logback-core-1.2.13.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\logback-classic-1.2.13.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jline-2.14.6.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-util-ajax-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-util-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-servlet-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-server-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-security-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-io-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jetty-http-9.4.53.v20231009.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\javax.servlet-api-3.1.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jackson-databind-2.15.2.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jackson-core-2.15.2.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\jackson-annotations-2.15.2.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\commons-io-2.11.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\commons-cli-1.5.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\lib\audience-annotations-0.12.0.jar;C:\Program Files\Appian\services\zookeeper-3.8.4\conf, org.apache.zookeeper.server.quorum.QuorumPeerMain, C:\Program Files\Appian\services\conf\zookeeper.properties]' in C:\Program Files\Appian\services\zookeeper-3.8.4\bin with environment [:]
    Starting QuorumPeerMain...
    process QuorumPeerMain running
    ZooKeeper connected, root child count of [9]
    QuorumPeerMain started in 1453 ms
    Service Zookeeper successfully started
    local Kafka broker is not registered
    Executing command: '[cmd, /c, start, "Kafka Server", /min, cmd, /c, C:\Program Files\Appian\services\kafka_2.13-3.3.1-appian-34\bin\windows\kafka-server-start.bat, C:\Program Files\Appian\services\conf\kafka-server.properties, --override, log.dirs=C:\Program Files\Appian\services\data\kafka-logs, --override, min.insync.replicas=1, --override, listeners=PLAINTEXT://localhost:9092, --override, zookeeper.connect=localhost:2181, --override, advertised.listeners=PLAINTEXT://localhost:9092, --override, broker.id=0, --override, zookeeper.connection.timeout.ms=40000, --override, zookeeper.session.timeout.ms=40000, --override, offsets.topic.replication.factor=1, --override, transaction.state.log.replication.factor=1, --override, transaction.state.log.min.isr=1]' in C:\Program Files\Appian\services\kafka_2.13-3.3.1-appian-34\bin\windows with environment [KAFKA_HEAP_OPTS:-Xms512m -Xmx1024m, KAFKA_OPTS:-Duser.timezone=GMT, KAFKA_JMX_OPTS: , LOG_DIR:C:\Program Files\Appian\logs\service-manager\kafka, CLASSPATH:, KAFKA_LOG4J_OPTS:-Dlog4j.configuration=file:///C:/Program%20Files/Appian/services/conf/kafka-log4j.properties]
    Starting Kafka...
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    Unable to start service Kafka
    java.util.concurrent.TimeoutException: null
    at java.util.concurrent.FutureTask.get(FutureTask.java:204) ~[?:?]
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:153) ~[guava-32.1.2-jre.jar:?]
    at com.appian.komodo.JavaProcessUtil.timedOperation(JavaProcessUtil.groovy:30) ~[common-9.7.0-internal.jar:9.7.0]
    at com.appian.komodo.JavaProcessUtil.waitUntilJavaProcessAvailable(JavaProcessUtil.groovy:63) ~[common-9.7.0-internal.jar:9.7.0]
    at com.appian.komodo.translog.services.DistributedTransactionLogService$Trait$Helper.start(DistributedTransactionLogService.groovy:38) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.services.Kafka.start(Kafka.groovy) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog$_startService_closure1.doCall(DistributedTransactionLog.groovy:133) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog$_startService_closure1.call(DistributedTransactionLog.groovy) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog.retryableLaunch(DistributedTransactionLog.groovy:121) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog.startService(DistributedTransactionLog.groovy:131) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog.startTransactionLog(DistributedTransactionLog.groovy:162) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog.access$0(DistributedTransactionLog.groovy) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog$_runWithExitCode_closure2.doCall(DistributedTransactionLog.groovy:211) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog$_runWithExitCode_closure2.call(DistributedTransactionLog.groovy) ~[service-manager-9.7.0.jar:9.7.0]
    at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1607) ~[groovy-3.0.19.jar:3.0.19]
    at com.appian.komodo.translog.DistributedTransactionLog.runWithExitCode(DistributedTransactionLog.groovy:209) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.KomodoScript.executeNoExit(KomodoScript.groovy:131) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog.start(DistributedTransactionLog.groovy:47) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.translog.DistributedTransactionLog$start.call(Unknown Source) ~[?:?]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148) ~[groovy-3.0.19.jar:3.0.19]
    at com.appian.komodo.StartKomodo.startDistributedTransactionLog(StartKomodo.groovy:172) ~[service-manager-9.7.0.jar:9.7.0]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107) ~[groovy-3.0.19.jar:3.0.19]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) ~[groovy-3.0.19.jar:3.0.19]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1254) ~[groovy-3.0.19.jar:3.0.19]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030) ~[groovy-3.0.19.jar:3.0.19]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:814) ~[groovy-3.0.19.jar:3.0.19]
    at groovy.lang.GroovyObject.invokeMethod(GroovyObject.java:39) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:55) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) ~[groovy-3.0.19.jar:3.0.19]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185) ~[groovy-3.0.19.jar:3.0.19]
    at com.appian.komodo.StartKomodo.runWithExitCode(StartKomodo.groovy:103) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.KomodoScript.executeNoExit(KomodoScript.groovy:131) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.KomodoScript.execute(KomodoScript.groovy:146) ~[service-manager-9.7.0.jar:9.7.0]
    at com.appian.komodo.StartKomodo.main(StartKomodo.groovy:74) ~[service-manager-9.7.0.jar:9.7.0]
    process Kafka shutdown
    local Kafka broker is not registered
    Executing command: '[cmd, /c, start, "Kafka Server", /min, cmd, /c, C:\Program Files\Appian\services\kafka_2.13-3.3.1-appian-34\bin\windows\kafka-server-start.bat, C:\Program Files\Appian\services\conf\kafka-server.properties, --override, log.dirs=C:\Program Files\Appian\services\data\kafka-logs, --override, min.insync.replicas=1, --override, listeners=PLAINTEXT://localhost:9092, --override, zookeeper.connect=localhost:2181, --override, advertised.listeners=PLAINTEXT://localhost:9092, --override, broker.id=0, --override, zookeeper.connection.timeout.ms=40000, --override, zookeeper.session.timeout.ms=40000, --override, offsets.topic.replication.factor=1, --override, transaction.state.log.replication.factor=1, --override, transaction.state.log.min.isr=1]' in C:\Program Files\Appian\services\kafka_2.13-3.3.1-appian-34\bin\windows with environment [KAFKA_HEAP_OPTS:-Xms512m -Xmx1024m, KAFKA_OPTS:-Duser.timezone=GMT, KAFKA_JMX_OPTS: , LOG_DIR:C:\Program Files\Appian\logs\service-manager\kafka, CLASSPATH:, KAFKA_LOG4J_OPTS:-Dlog4j.configuration=file:///C:/Program%20Files/Appian/services/conf/kafka-log4j.properties]
    Starting Kafka...
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka
    waiting for process Kafka

  • 0
    Certified Lead Developer
    in reply to jarunb

    Could you please execute status.sh and paste the result here?

  • No Kafka brokers are available using bootstrap servers: localhost:9092

    Kafka Broker Connectivity
    ------------------------------------------------------------------
    localhost:9092 Unreachable

    Zookeeper Connectivity
    ------------------------------------------------------------------
    localhost:2181 Reachable standalone