public synchronized ClickstreamConfig getConfig() {
		if (config != null) {
			return config;
		}

		InputStream is = getInputStream("clickstream.xml");

		if (is == null) {
			is = getInputStream("/clickstream.xml");
		}
		if (is == null) {
			is = getInputStream("META-INF/clickstream-default.xml");
		}
		if (is == null) {
			is = getInputStream("/META-INF/clickstream-default.xml");
		}

		config = new ClickstreamConfig();

		try {
			log.debug("Loading config");
			SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
			parser.parse(is, new ConfigHandler());
			return config;
		}
		catch (SAXException e) {
			log.error("Could not parse config XML", e);
			throw new RuntimeException(e.getMessage());
		}
		catch (IOException e) {
			log.error("Could not read config from stream", e);
			throw new RuntimeException(e.getMessage());
		}
		catch (ParserConfigurationException e) {
			log.fatal("Could not obtain SAX parser", e);
			throw new RuntimeException(e.getMessage());
		}
		catch (RuntimeException e) {
			log.fatal("RuntimeException", e);
			throw e;
		}
		catch (Throwable e) {
			log.fatal("Exception", e);
			throw new RuntimeException(e.getMessage());
		}
	}