启动

ServerStarter

ServerStarter.main()
public static void main(String [] args) {
    new ServerStarter().start();
}
ServerStarter.start()
private void start() {
	try {
		final ClassLoader parent = findParentClassLoader();

		String libDirString = System.getProperty("openfire.lib.dir");

		File libDir;
		if (libDirString != null) {
			libDir = new File(libDirString);
			if (!libDir.exists()) {
				Log.warn("Lib directory " + libDirString +
						" does not exist. Using default " + DEFAULT_LIB_DIR);
				libDir = new File(DEFAULT_LIB_DIR);
			}
		}
		else {
			libDir = new File(DEFAULT_LIB_DIR);
		}

		String adminLibDirString = System.getProperty("openfireHome");
		if (adminLibDirString == null) {
			adminLibDirString = DEFAULT_ADMIN_LIB_DIR;
		}
		else {
			adminLibDirString = adminLibDirString+"/plugins/admin/webapp/WEB-INF/lib";
		}
		File adminLibDir = new File(adminLibDirString);
		if (!adminLibDir.exists()) {
			Log.warn("Admin Lib Directory " + adminLibDirString +
				" does not exist. Web admin console may not work.");
		}

		ClassLoader loader = new JiveClassLoader(parent, libDir);

		Thread.currentThread().setContextClassLoader(loader);
		// 加载XMPPServer类
		Class containerClass = loader.loadClass(
				"org.jivesoftware.openfire.XMPPServer");
		containerClass.newInstance();
	}
	catch (Exception e) {
		e.printStackTrace();
	}
}

XMPPServer

Last updated