gpt4 book ai didi

java - 获取 java.lang.NoClassDefFoundError : org/apache/xerces/dom/ElementNSImpl with Apache ODF Toolkit

转载 作者:行者123 更新时间:2023-12-01 14:15:25 24 4
gpt4 key购买 nike

我正在尝试使用 Apache ODF Toolkit 读取 ods 文件。我在尝试使用以下代码加载电子表格时收到 java.lang.NoClassDefFoundError 错误-

SpreadsheetDocument data = SpreadsheetDocument.loadDocument(file);

下面是错误跟踪-

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/dom/ElementNSImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at test.read.ODSFile.ReadODS.main(ReadODS.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.dom.ElementNSImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more

下面是项目结构,其中显示了类路径- Eclipse screenshot

是否缺少任何依赖项?

最佳答案

您的代码似乎找不到该类:引起原因:java.lang.ClassNotFoundException:org.apache.xerces.dom.ElementNSImpl

来自ODF Toolkit

注意:ODFDOM 需要 Apache Xerces。 jar 文件 xercesImpl.jar 还必须存在于 odfxsltrunner.jar 文件旁边的 lib 文件夹中,或者它必须位于类路径中。 ODF XSLT Runner NetBeans 项目在运行时类路径中包含对 xersesImpl.jar 的引用,在 checkout 项目后必须对其进行调整。

关于java - 获取 java.lang.NoClassDefFoundError : org/apache/xerces/dom/ElementNSImpl with Apache ODF Toolkit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18147937/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com