Avatar ·

How to defeat "Xerces Hell" in Java/Maven projects?

Hello everyone! I'm a beginner Java developer and have been struggling for the second week with a problem that the internet calls "Xerces Hell". \n\nWe have a large Maven project (Spring Boot + Hibernate). Suddenly, when running tests, errors started appearing like:\n\n```\njava.lang.NoSuchMethodError: org.apache.xerces.impl.dv.util.Base64.(Ljava/lang/String;)V\n```\n\nor\n\n```\njava.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser\n```\n\nMoreover, in some modules the code works, in others it doesn't. I added the xerces dependency explicitly in pom.xml, but it only made things worse. Now I have two different classes org.apache.xerces.jaxp.SAXParserImpl in my classpath — one from the xercesImpl library, another from xml-apis.\n\nI tried excluding transitive dependencies via — it partially helped, but