java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String

java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String;

This will happen when there are Xerces JAR files in your WAR’s /WEB-INF/lib (or even JRE’s /lib) which is of an older version than the one internally used by the servletcontainer. The older version, which apparently implements JAXP of Java 1.4.2 or older, is missing the mentioned method which was introduced in JAXP of Java 1.5.

There are 2 options:

  1. Upgrade Xerces JAR files to a newer version matching at least the one used the servletcontainer.

  2. Remove those Xerces JAR files from /WEB-INF/lib. They do actually not belong there. The servletcontainer comes with its own JAXP implementation. You don’t need to supply your own via the webapp.

Option 2 is recommended. Watch out when using a dependency management framework such as Maven. Some poor libraries will specifically include a JAXP implementation as a transitive dependency even though the API is already part of Java SE.

Note that the concrete problem is unrelated to OmniFaces. It’s just caused by classpath pollution. OmniFaces uses JAXP to parse the web.xml (and web-fragment.xml) and extract the error page locations. Update: this specific exception shouldn’t occur anymore since OmniFaces 2.0 as it has as per issue 90 replaced getTextContent() calls by getFirstChild().getNodeValue().

Leave a Comment