mercredi 22 juillet 2020

what causes java.lang.NoClassDefFoundError to occur randomly?

We've been getting NoClassDefFoundError in our server randomly. It Occasionally throws this error, and most of the time it runs without throwing any issue. What could be the reason for such behavior? Below is the exception.

java.lang.NoClassDefFoundError: Could not initialize class com.github.junrar.Archive
at org.apache.tika.parser.pkg.RarParser.parse(RarParser.java:75)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143)
at org.apache.tika.Tika.parseToString(Tika.java:527)
at org.apache.tika.Tika.parseToString(Tika.java:602)
at com.xxx.attachment.AttachmentExtractionAPI.parse(AttachmentExtractionAPI.java:108)

com.github.junrar.Archive is present in the same jar which contains other tika dependencies.

I tried looking into the source of Archive.java. Looking for some possible runtime exception in static blocks. But it doesn't have a static block itself. What could have made this to throw exception randomly and run without problem at times?




Aucun commentaire:

Enregistrer un commentaire