Apparently a fix that is in the createSingleton(String name) class is not applied in createSingleton(). It causes the getInstance to throw "java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory" whenever there is class loader mismatch.
More reasonable error message, since it will show on the build log.
Merge pull request #4 from rnowosielski/DifferentClassLoadersIssue

org.dom4j.DocumentFactory.getInstance throws