jenkinsci/jenkins · warning · RestartNotSupportedException

Default Windows lifecycle does not support restart.

Error message

Default Windows lifecycle does not support restart.

What it means

Thrown by an anonymous Lifecycle subclass installed on Windows when no Windows-native lifecycle implementation (e.g. WindowsServiceLifecycle) is available. verifyRestartable() is overridden to always throw RestartNotSupportedException. This is the fallback path: Jenkins detected it is on Windows but could not install the WMI/service-based lifecycle, so restart via the in-process 'safe restart' is permanently disabled.

Source

Thrown at core/src/main/java/hudson/lifecycle/Lifecycle.java:109

                } catch (ClassNotFoundException e) {
                    LOGGER.log(Level.FINE, e, () -> "Failed to load " + p + " so will try again later");
                    instance = new PlaceholderLifecycle();
                } catch (InvocationTargetException e) {
                    Throwable t = e.getCause();
                    switch (t) {
                        case RuntimeException runtimeException -> throw runtimeException;
                        case IOException ioException -> throw new UncheckedIOException(ioException);
                        case Exception exception -> throw new RuntimeException(t);
                        case Error error -> throw error;
                        case null, default -> throw new Error(e);
                    }
                }
            } else {
                if (Functions.isWindows()) {
                    instance = new Lifecycle() {
                        @Override
                        public void verifyRestartable() throws RestartNotSupportedException {
                            throw new RestartNotSupportedException(
                                    "Default Windows lifecycle does not support restart.");
                        }
                    };
                } else if (System.getenv("SMF_FMRI") != null && System.getenv("SMF_RESTARTER") != null) {
                    // when we are run by Solaris SMF, these environment variables are set.
                    instance = new SolarisSMFLifecycle();
                } else if (System.getenv("NOTIFY_SOCKET") != null) {
                    // When we are running under systemd with Type=notify, this environment variable is set.
                    instance = new SystemdLifecycle();
                } else {
                    // if run on Unix, we can do restart
                    try {
                        instance = new UnixLifecycle();
                    } catch (final Throwable t) {
                        LOGGER.log(Level.WARNING, "Failed to install embedded lifecycle implementation", t);
                        instance = new Lifecycle() {
                            @Override
                            public void verifyRestartable() throws RestartNotSupportedException {

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Install Jenkins as a Windows service so WindowsServiceLifecycle is used instead
  2. Use the command-line 'java -jar jenkins.war' and perform restarts manually by stopping and restarting the process
  3. Set a custom Lifecycle via -Djenkins.lifecycle=... if you have your own implementation
  4. If restart is required for upgrades, shut down and restart the whole host process manually
Defensive patterns

Strategy: validation

Validate before calling

Lifecycle lc = Lifecycle.get();
if (!lc.canRestart()) {
    // disable restart UI / inform user instead of calling restart()
    return;
}

Try / catch

try {
    Lifecycle.get().verifyRestartable();
    Lifecycle.get().restart();
} catch (RestartNotSupportedException e) {
    // graceful: inform the user restart is unsupported on Windows without service
}

Prevention

When it happens

Trigger: Lifecycle.get() sets instance to this anonymous class when Functions.isWindows() is true and no other lifecycle was configured (e.g. no -Djenkins.lifecycle property pointing to a custom Lifecycle). Any code calling verifyRestartable() or restart() — such as the 'Restart' Jenkins UI button or Jenkins.restartIfNotLoaded() — triggers it.

Common situations: Running Jenkins via 'java -jar jenkins.war' directly on Windows without the Windows service wrapper installed; running embedded in an IDE for development; deploying on Windows in a container without service infrastructure.

Related errors


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/fd8555b945396fbb. Report an issue: GitHub.