Apache Cassandra as Windows service terminate after start

  apache-commons-daemon, cassandra, service, windows

If I run Apache Cassandra as Windows service then it terminated after starting is finish. If start it via cassandra.bat file al run correctly. From the log files ist look like that the main thread is finish and then the main thread terminated which terminate the service.

INFO  [main] 2020-11-12 10:39:35,061 StorageService.java:1492 - JOINING: Finish joining ring
INFO  [main] 2020-11-12 10:39:35,268 NativeTransportService.java:73 - Netty using Java NIO event loop
INFO  [main] 2020-11-12 10:39:35,307 Server.java:158 - Using Netty Version: [netty-buffer=netty-buffer-4.0.44.Final.452812a, netty-codec=netty-codec-4.0.44.Final.452812a, netty-codec-haproxy=netty-codec-haproxy-4.0.44.Final.452812a, netty-codec-http=netty-codec-http-4.0.44.Final.452812a, netty-codec-socks=netty-codec-socks-4.0.44.Final.452812a, netty-common=netty-common-4.0.44.Final.452812a, netty-handler=netty-handler-4.0.44.Final.452812a, netty-tcnative=netty-tcnative-1.1.33.Fork26.142ecbb, netty-transport=netty-transport-4.0.44.Final.452812a, netty-transport-native-epoll=netty-transport-native-epoll-4.0.44.Final.452812a, netty-transport-rxtx=netty-transport-rxtx-4.0.44.Final.452812a, netty-transport-sctp=netty-transport-sctp-4.0.44.Final.452812a, netty-transport-udt=netty-transport-udt-4.0.44.Final.452812a]
INFO  [main] 2020-11-12 10:39:35,307 Server.java:159 - Starting listening for CQL clients on localhost/ (unencrypted)...
INFO  [main] 2020-11-12 10:39:35,398 CassandraDaemon.java:564 - Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it
INFO  [main] 2020-11-12 10:39:35,398 CassandraDaemon.java:650 - Startup complete
INFO  [OptionalTasks:1] 2020-11-12 10:39:45,263 CassandraRoleManager.java:372 - Created default superuser role 'cassandra'
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:00,534 HintsService.java:209 - Paused hints dispatch
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:00,536 Server.java:179 - Stop listening for CQL clients
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:00,536 Gossiper.java:1662 - Announcing shutdown
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:00,538 StorageService.java:2408 - Node localhost/ state jump to shutdown
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:02,539 MessagingService.java:985 - Waiting for messaging service to quiesce
INFO  [ACCEPT-localhost/] 2020-11-12 10:40:02,540 MessagingService.java:1346 - MessagingService has terminated the accept() thread
INFO  [StorageServiceShutdownHook] 2020-11-12 10:40:02,606 HintsService.java:209 - Paused hints dispatch

If I start it via cassandra.bat then the log output stops on Startup complete.

I try Apache Cassandra 3.11.9 and the Apache Commons Daemon 1.2.3. Both are the latest version. The Java version is 1.8.211.

How can I solve this?

Source: Windows Questions