public void finishSetup() {
        if (!setupMode) {
            return;
        }

        this.finalSetupSteps();

        // Make sure that setup finished correctly.
        if ("true".equals(JiveGlobals.getXMLProperty("setup"))) {
            // Iterate through all the provided XML properties and set the ones that haven't
            // already been touched by setup prior to this method being called.

            Thread finishSetup = new Thread(() -> {
                try {
                    if (isStandAlone()) {
                        // Always restart the HTTP server manager. This covers the case
                        // of changing the ports, as well as generating self-signed certificates.

                        // Wait a short period before shutting down the admin console.
                        // Otherwise, the page that requested the setup finish won't
                        // render properly!
                        Thread.sleep(1000);
                        pluginManager.getPluginByCanonicalName("admin").ifPresent(plugin -> ((AdminConsolePlugin) plugin).restart());
                    }

                    verifyDataSource();
                    // First load all the modules so that modules may access other modules while
                    // being initialized
                    loadModules();
                    // Initize all the modules
                    initModules();
                    // Start all the modules
                    startModules();
                    scanForSystemPropertyClasses();
                }
                catch (Exception e) {
                    e.printStackTrace();
                    logger.error(e.getMessage(), e);
                    shutdownServer();
                }
            });
            // Use the correct class loader.
            finishSetup.setContextClassLoader(loader);
            finishSetup.start();
            // We can now safely indicate that setup has finished
            setupMode = false;
        }
    }
Finish the setup process. Because this method is meant to be called from inside
the Admin console plugin, it spawns its own thread to do the work so that the
class loader is correct.
xmppserver/src/main/java/org/jivesoftware/openfire/XMPPServer.java