jokiazhang / metadata-extractor

Automatically exported from code.google.com/p/metadata-extractor
0 stars 0 forks source link

Adobe XMP parser exception #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
when i upload a image with XMP meta data, I cannot upload an image not retrieve 
the meta data.
Here is the error i see in my logs.
java.lang.AbstractMethodError: 
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
    at com.adobe.xmp.impl.XMPMetaParser.createDocumentBuilderFactory(Unknown Source)
    at com.adobe.xmp.impl.XMPMetaParser.<clinit>(Unknown Source)
    at com.adobe.xmp.XMPMetaFactory.parseFromBuffer(Unknown Source)
    at com.adobe.xmp.XMPMetaFactory.parseFromBuffer(Unknown Source)
    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 com.drew.imaging.ImageMetadataReader.readMetadata(Unknown Source)
    at com.drew.imaging.ImageMetadataReader.readMetadata(Unknown Source)

I am using the latest extractor on your website. 2.5.0 RC2

Original issue reported on code.google.com by shrutiv...@gmail.com on 2 Aug 2011 at 4:30

GoogleCodeExporter commented 9 years ago
Are you able to provide a sample image? 

Original comment by drewnoakes on 2 Aug 2011 at 6:09

GoogleCodeExporter commented 9 years ago
sure, here is the image attached. This one has xmp meta data in it and throws 
the above exception.

Original comment by shrutiv...@gmail.com on 2 Aug 2011 at 6:17

Attachments:

GoogleCodeExporter commented 9 years ago
In my case, it was caused by an incompatible xercesImpl.jar.

Original comment by tschlenk...@googlemail.com on 8 Sep 2011 at 9:35

GoogleCodeExporter commented 9 years ago
It was the same with me. The jars were incompatible. I downloaded the latest 
jar file. It works now!

Original comment by shrutiv...@gmail.com on 8 Sep 2011 at 12:03

GoogleCodeExporter commented 9 years ago
Same problem, using the 2.5.0 RC2.

Build XMPCore from Adobe sources doesn't fix the problem.

Can somebody tell me how to bypass the XMP metadata parsing ?

Original comment by guillaum...@gmail.com on 28 Sep 2011 at 8:22

GoogleCodeExporter commented 9 years ago
Observing issue against 2.5.0 RC3

Original comment by elegoul...@telecomdesign.fr on 14 May 2012 at 3:50

GoogleCodeExporter commented 9 years ago
I don't have an update on this right now, though my plan is to restructure the 
API a bit to support external providers, and then make the XMP stuff external, 
and therefore optional.

This would also allow others to provide their own external metadata providers.

---

Note that in this case, the exception is an 'uncatchable' AbstractMethodError, 
indicating:

> Normally, this error is caught by the compiler; this error can only occur at 
run time if the definition of some class has incompatibly changed since the 
currently executing method was last compiled.

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/AbstractMethodError.html

Therefore the solution to this problem is to have the expected version of all 
jars available.

I'll close this issue and create a 'Troubleshooting' page on the wiki with this 
information.

Original comment by drewnoakes on 15 May 2012 at 12:10

GoogleCodeExporter commented 9 years ago
The page is now here:

http://code.google.com/p/metadata-extractor/wiki/Troubleshooting

Original comment by drewnoakes on 15 May 2012 at 12:18

GoogleCodeExporter commented 9 years ago
I had the same problems - for me the following solution worked for this issue:

Apparently the xmpcore.jar delivered with version 2.6.2 calls the method 
javax.xml.parsers.DocumentBuilderFactory.setFeature(java/lang/String). 
Referring to the JDK 5.0 resp. 6.0 Java API Specification the setFeature method 
in DocumentBuilderFactory is however implemented with setFeature(String name, 
boolean value). So I downloaded a current version (5.1.0) of the XMP Library 
for Java CS6 from Adobe and compiled it without any modifications (which 
changes the setFeature() call). Now the following patch has to applied to 
com.drew.metadata.xmp.XmpReader:

@@ -156,9 +156,9 @@
             for (XMPIterator iterator = xmpMeta.iterator(); iterator.hasNext();) {
                 XMPPropertyInfo propInfo = (XMPPropertyInfo) iterator.next();
                 String path = propInfo.getPath();
-                Object value = propInfo.getValue();
+                String value = propInfo.getValue();
                 if (path != null && value != null)
-                    directory.addProperty(path, value.toString());
+                    directory.addProperty(path, value);
             }

Original comment by thoralf....@gmail.com on 15 Aug 2012 at 3:52