简体   繁体   中英

java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl

Any suggestions to resolve this issue, exception details as below

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl
    at com.fgn.odf.model.odfParserM.loadOdfDocument(odfParserM.java:34)
    at com.fgn.odf.OdfConverterApplication.main(OdfConverterApplication.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 2 more

This happens when it reach here (code mentioned below) - and this class is from a library added to pom.xml (maven dependencies)

OdfPackage pkg = OdfPackage.loadPackage(documentPath);

Anybody please suggests me what could be wrong??

add maven dependency for org.apache.xerces.jaxp

<dependency>
 <groupId>xerces</groupId> 
 <artifactId>xerces</artifactId>
 <version>2.4.0</version> 
</dependency>

Add a maven dependency

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.8.0</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM