title: Log4j2 error on load XML configuration file
body: <p>I'm trying to use an XML configuration file for Log4j2 that is embedded in my Java application, but is not working.</p>
  
  <p>The code:</p>
  
  <pre><code>ConfigurationSource source = new ConfigurationSource(Main.class.getResourceAsStream("/in/gunbound/prelauncher/server/log4j2/log4j2.xml"));
  ConfigurationFactory factory = (ConfigurationFactory) XMLConfigurationFactory.getInstance().getConfiguration(source);
  ConfigurationFactory.setConfigurationFactory(factory);
  </code></pre>
  
  <p>The error:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException:
    org.apache.logging.log4j.core.config.XMLConfiguration cannot be cast
    to org.apache.logging.log4j.core.config.ConfigurationFactory  at
    in.gunbound.prelauncher.server.Main.main(Main.java:62)</p>
  </blockquote>