I\'m using logback with groovy and get lots of warnings showing up when parsing xml. I am aware of the bug in JDK1.7_u45 that is causing this.
Warning: org.apa
If it is not possible to remove xerces from the classpath, you can be more explicit about which factory you want to use, thus avoiding pulling in xerces. Here are two ways of resolving specific factories:
public static SchemaFactory getSchemaFactory() {
return schemaFactory =
SchemaFactory.newInstance(
"http://www.w3.org/2001/XMLSchema",
"com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory",
null);
}
public static TransformerFactory getTransformerFactory() {
try {
final Class> transformerFactoryImplClass =
TransformerFactory.class
.getClassLoader().loadClass("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
final Method factoryGetter =
transformerFactoryImplClass.getDeclaredMethod("newTransformerFactoryNoServiceLoader");
return (TransformerFactory) factoryGetter.invoke(null);
} catch (ClassNotFoundException
| NoSuchMethodException
| IllegalAccessException
| InvocationTargetException e) {
// fallback in case com.sun.* is not available
return TransformerFactory.newInstance();
}
}