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.

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top