Then catch RuntimeException and FactoryConfigurationError. Add comment in RuntimeException block that it is needed to catch possible run-time errors like NullPointerException, NumberFormatException and DOMException. General rule is "don't catch Errors", but there are exceptions out of that rule, so catching particular ancestor of Error class is fine.