private void initialize() throws FileNotFoundException {
        locateOpenfire();

        if ("true".equals(JiveGlobals.getXMLProperty("setup"))) {
            setupMode = false;
        }

        if (isStandAlone()) {
            logger.info("Registering shutdown hook (standalone mode)");
            Runtime.getRuntime().addShutdownHook(new ShutdownHookThread());
            terminatorTimer = new Timer(); // Not using TaskEngine here, as that requires configuration to be available, which it is not yet.
            terminatorTimer.schedule(new Terminator(), 1000, 1000);
        }

        loader = Thread.currentThread().getContextClassLoader();

        try {
            CacheFactory.initialize();
        } catch (InitializationException e) {
            e.printStackTrace();
            logger.error(e.getMessage(), e);
        }

        JiveGlobals.migrateProperty(XMPPServerInfo.XMPP_DOMAIN.getKey());

        JiveGlobals.migrateProperty(Log.DEBUG_ENABLED.getKey());
        if (Log.DEBUG_ENABLED.getValue()) {
            Log.setDebugEnabled(true);
        }
        if (Log.TRACE_ENABLED.getValue()) {
            Log.setTraceEnabled(true);
        }

        // Update server info
        xmppServerInfo = new XMPPServerInfoImpl(new Date());

        initialized = true;

        if (setupMode && "true".equals(JiveGlobals.getXMLProperty("autosetup.run"))) {
            this.runAutoSetup();
            JiveGlobals.deleteXMLProperty("autosetup");
            JiveGlobals.deleteProperty("autosetup");
        }

        // OF-1548: Move the storage of the FQDN from the database to the XML configuration
        final String hostNameFromDatabase = JiveGlobals.getProperty("xmpp.fqdn", "");
        final String hostNameFromXML = JiveGlobals.getXMLProperty("fqdn", "");
        if (!hostNameFromDatabase.isEmpty() && hostNameFromXML.isEmpty()) {
            final String hostname;
            if (ClusterManager.isClusteringEnabled()) {
                // The database value has at best a 50% chance of being right - so instead use a sensible default
                String hostnameFromOS;
                try {
                    hostnameFromOS = InetAddress.getLocalHost().getCanonicalHostName();
                } catch (final UnknownHostException e) {
                    logger.warn("Unable to determine local hostname", e);
                    hostnameFromOS = "localhost";
                }
                hostname = hostnameFromOS;
            } else {
                hostname = hostNameFromDatabase;
            }
            JiveGlobals.setXMLProperty("fqdn", hostname);
            JiveGlobals.deleteProperty("xmpp.fqdn");
        }
    }
Removes a server listener that was being notified when the server was being started
or was about to be stopped.

@param listener the server listener to remove.
xmppserver/src/main/java/org/jivesoftware/openfire/XMPPServer.java