java.lang.NoClassDefFoundError: 无法初始化类 org.apache.pdfbox.pdmodel.font.PDFont [英] java.lang.NoClassDefFoundError: Could not initialize class org.apache.pdfbox.pdmodel.font.PDFont

查看:62
本文介绍了java.lang.NoClassDefFoundError: 无法初始化类 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆