I've searched the archives and not found much related to this issue. We have been running NIFI as a Windows Service using https://github.com/mikenac/nifi-windowsservice, which uses the Apache ProcRun (https://commons.apache.org/proper/commons-daemon/procrun.html) project. This was using the RunNifi class has been working will for many years. This project hasn't been updated in over 3 years.
In August of 2024, the following commit was merged ( https://github.com/apache/nifi/pull/9192) NIFI-13665 Refactor Bootstrap and Runtime Process Handling, with the work completed by exceptionfactory (David Handermann ). This commit removed the RunNifi class and added like 15 classes instead. I've made an attempt update the WindowsService.java file to use the new bootstrap API. More on that later. Am I going about this the right way? Should I be using nifi-runtime instead of nifi-bootstrap? Are others running NiFi as a windows service? If so, what are the best practices (I've not seen anything in the NIFI documentation other than its not supported by the NiFi team directly.)? Any other suggestions? I've updated the WindowsService.java (from the nifi-windowsservice) to the following: package org.apache.nifi.bootstrap; import org.apache.nifi.bootstrap.command.BootstrapCommand; import org.apache.nifi.bootstrap.command.BootstrapCommandProvider; import org.apache.nifi.bootstrap.command.StandardBootstrapCommandProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; ========== public class WindowsService { private static final Logger commandLogger = LoggerFactory.getLogger("org.apache.nifi.bootstrap.command.BootstrapCommand"); public static void start (String[] args) throws InterruptedException{ runCommand("start"); } public static void stop(String[] args) throws InterruptedException { runCommand("stop"); } public static void main(final String[] arguments) throws InterruptedException { if(arguments.length >= 1) { runCommand(arguments[0]); } else { System.out.println("Missing arguments"); } } public static void runCommand(String cmd) throws InterruptedException { System.out.println("Sysout - WindowsService-NiFi " + cmd + " method begin."); commandLogger.info("WindowsService-NiFi " + cmd + " method begin."); BootstrapCommandProvider bootstrapCommandProvider = new StandardBootstrapCommandProvider(); BootstrapCommand bootstrapCommand = bootstrapCommandProvider.getBootstrapCommand(new String[]{cmd}); bootstrapCommand.run(); // TODO wait for command status to not be running? commandLogger.info("WindowsService-NiFi " + cmd + " method end."); System.out.println("Sysout - WindowsService-NiFi " + cmd + " method end."); } ======== If I run this application with java.exe, it seems to behave as I would like and starts up NiFi. However, if I run it using nifi-service.exe, NiFi wants to create a new process using StandardProcessBuilderProvider, which looks at the path of the current process (nifi-service.exe) and tries to launch a new process with the same exe, treating it like a Java process, passing it a --class-path command line parameter and a java class string. I'm not seeing an obvious way to override this behavior. Any assistance here would be greatly appreciated. Thanks, -Phil