Solution to DVFactoryException for wsdl2java

If you’re seeing this error when using cxf-codegen-plugin, there is an easy solution:

org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory.

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.version}</version>
    <dependencies>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.8.1</version>
        </dependency>
    </dependencies>
    ...
</plugin>

The key part is to add the Xerces dependency. After that you should no longer see that error when you generate Java stubs from the wsdl.


Comments are closed.