Search code examples
pdfboxapache-tikawildfly-10

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


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


Solution

  • 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