When generating a site with Maven, we encountered the following exception when a particular reporting plugin was executed:
org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.
This basically meant that an incompatible version of xerces was trying to be run. We have everything set to use Java 1.6, which ships with its own version of xerces. After some debugging, it was tracked down to the maven-site-plugin which we had recently upgraded to use version 2.1 of the plugin by specifying it in our pom file like so:
<pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.1</version> </plugin> </plugins> </pluginManagement>
The maven-site-site plugin has the following dependency structure:
- org.apache.maven.plugins:maven-site-plugin:maven-plugin:2.1
- org.apache.maven.doxia:doxia-module-xhtml:jar:1.1.2 (compile)
- org.apache.maven.doxia:doxia-core:jar:1.1.2 (compile)
- xerces:xercesImpl:jar:2.8.1 (compile)
- org.apache.maven.doxia:doxia-core:jar:1.1.2 (compile)
- org.apache.maven.doxia:doxia-module-xhtml:jar:1.1.2 (compile)
It is the dependency of the xercesImpl jar 2.8.1 that is the problem. To get around this issue, you can tell the maven-site-plugin to exclude a particular dependency. This can be done like so:
<pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.1</version> <dependencies> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> <version>1.1.2</version> <exclusions> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> </exclusions> </dependency> </dependencies> </plugin> </plugins> </pluginManagement>
There are a couple of maven reporting plugins that we found produced this exception when run with maven-site-plugin 2.1. These plugins are:
If you use an older version of the maven-site-plugin then the above mentioned reporting plugins should work ok. It is only when specifying a version of 2.1 or above that the exception occurs.
Some of the solutions suggested on the net didn’t work for us, like adding the xercesImpl jar as a dependency to the actual reporting plugin in question, so hopefully the solution mentioned in this post is helpful.
3D Secure and the PaReq field in Google Chrome & Safari Browsers
JSF, Iterating with tomahawk radio buttons, t:datalist, a4j:repeat
Very Helpful..Thanks for posting your research. This saved lot of my debugging time.
ROFL you saved my day – you post helped me to get my own plugin working at a customer site …
The plugin moved to “http://mojo.codehaus.org/webtest-maven-plugin/” and I will have a look how to fix that issues since it also happens with maven-site-plugin-3.0
Thanks you for saving me some time.
Awesome info. Got this error message after including openid4java-0.9.7 in my project and this exclusion fixed the problem.