Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError when using Apache Tika

Tags:

apache-tika

The following error is encountered when I extract the metadata of a JPEG image using Apache Tika

java.lang.NoSuchMethodError: com.adobe.xmp.properties.XMPPropertyInfo.getValue()Ljava/lang/Object;
at com.drew.metadata.xmp.XmpReader.extract(Unknown Source)
at com.drew.imaging.jpeg.JpegMetadataReader.extractMetadataFromJpegSegmentReader(Unknown Source)
at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(Unknown Source)
at org.apache.tika.parser.image.ImageMetadataExtractor.parseJpeg(ImageMetadataExtractor.java:91)
at org.apache.tika.parser.jpeg.JpegParser.parse(JpegParser.java:56)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120

Tika version being used: Tika 1.4

What is the cause of the error?

Also note that the metadata for an image that doesn't contain any XMP metadata is extracted by the API correctly. This error occurs only for those images that have XMP metadata.

like image 1000
Rocky Inde Avatar asked May 09 '26 18:05

Rocky Inde


1 Answers

Apache Tika uses the API : metadata-extractor to extract metadata from image files.

The most likely reason for the cause is if one has both tika and the metadata-extractor libraries in their classpath. The binary for metadata-extractor may have been built using a different version of XMPCore library compared with the one that Tika uses.

Solution: remove metadata-extractor's library from your classpath.

The issue with incompatible usage of XMPCore libraries by the two projects isn't resolved: https://code.google.com/p/metadata-extractor/issues/detail?id=55

like image 120
Rocky Inde Avatar answered May 14 '26 14:05

Rocky Inde