java.lang.NoClassDefFoundError:无法初始化类org.apache.pdfbox.pdmodel.font.PDFont [英] java.lang.NoClassDefFoundError: Could not initialize class org.apache.pdfbox.pdmodel.font.PDFont
问题描述
我在wildfly模块中使用Apache Tika(tika-app 1.17). 当我开始提取PDF时,它总是会引发错误:
I am using Apache Tika( tika-app 1.17) in wildfly modules. While I start extracting PDF it always throws the error:
java.lang.NoClassDefFoundError:无法初始化类 org.apache.pdfbox.pdmodel.font.PDFont
java.lang.NoClassDefFoundError: Could not initialize class org.apache.pdfbox.pdmodel.font.PDFont
对于其他文件扩展名,它可以正常工作. 我已经尝试了apache-tika module.xml到PDFbox中的依赖项 从standalone.xml显式加载org.apache.pdfbox
For other file extensions it works fine. Things I have tried out dependencies in apache-tika module.xml to PDFbox Explicitly loaded org.apache.pdfbox from standalone.xml
我也尝试了以下结构 app1.war->(WEB-INF)lib-> app.jar-> lib-> tika-app-1.17.jar
I have also tried with the below structure app1.war->(WEB-INF)lib-->app.jar->lib-->tika-app-1.17.jar
我也有jboss-deployment-structure.xml,其中
I have also jboss-deployment-structure.xml where
<dependencies>
<module name="com.company.tika" />
</dependencies>
提到
作为模块依赖项. 在jar的MANIFEST.MF中,我也依赖于com.company.tika
is mentioned as a module dependency. In MANIFEST.MF of the jar also, I have dependency to com.company.tika
似乎没有任何作用.
任何建议或帮助都会令人感激.
Any suggestions or help would be thankful.
预先感谢
德瓦
推荐答案
我可以解决此问题.问题是pdfbox的次要版本,fontbox和jempbox不同.因此,PDFFont尚未初始化,因为它在内部也需要加载fontbox的类,并且类的版本ID可能不匹配
I could resolve the issue. The problem was the minor version of pdfbox, fontbox and jempbox were not the same. Hence the PDFFont was not initialized, because internally it needs to load the classes of fontbox also and probably there was a mismatch in the version id of the classes
这篇关于java.lang.NoClassDefFoundError:无法初始化类org.apache.pdfbox.pdmodel.font.PDFont的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!