java.lang.NoClassDefFoundError: Could not initialize class org.apache.pdfbox.pdmodel.font.PDFont

隐身守侯 提交于 2019-12-11 14:08:25

问题


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: Could not initialize class org.apache.pdfbox.pdmodel.font.PDFont

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

I have also tried with the below structure app1.war->(WEB-INF)lib-->app.jar->lib-->tika-app-1.17.jar

I have also jboss-deployment-structure.xml where

    <dependencies>
      <module name="com.company.tika" />         
    </dependencies>

is mentioned as a module dependency. In MANIFEST.MF of the jar also, I have dependency to com.company.tika

Nothing seems to work.

Any suggestions or help would be thankful.

Thanks in Advance

Dwai


回答1:


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




回答2:


I had similar problem. Under linux i just install missing library pdfbox by:

apt-get install libpdfbox-java
and restart solr server

After this modification i need to change solr start parameter in ./bin/solr from

SOLR_JAVA_STACK_SIZE='-Xss256kb'

to

SOLR_JAVA_STACK_SIZE='-Xss256M'

because i had error

java.lang.StackOverflowErrorjava.lang.RuntimeException: java.lang.StackOverflowError

of course i restart solr server again.

I hope, it help you reolve this problem.



来源:https://stackoverflow.com/questions/49271596/java-lang-noclassdeffounderror-could-not-initialize-class-org-apache-pdfbox-pdm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!