jai-imageio / jai-imageio-core

JAI ImageIO Core (without javax.media.jai dependencies)
Other
234 stars 87 forks source link

ClassNotFoundException: com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet #19

Closed THausherr closed 7 years ago

THausherr commented 8 years ago

I tried using this library for a PDFBox build test, and got this:

java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:191) at com.github.jaiimageio.impl.plugins.tiff.TIFFImageMetadata.parseIFD(TIFFImageMetadata.java:1510) at com.github.jaiimageio.impl.plugins.tiff.TIFFImageMetadata.mergeNativeTree(TIFFImageMetadata.java:1603) at com.github.jaiimageio.impl.plugins.tiff.TIFFImageMetadata.mergeTree(TIFFImageMetadata.java:1627) at org.apache.pdfbox.tools.imageio.TIFFUtil.updateMetadata(TIFFUtil.java:115) at org.apache.pdfbox.tools.imageio.ImageIOUtil.writeImage(ImageIOUtil.java:248) at org.apache.pdfbox.tools.imageio.ImageIOUtil.writeImage(ImageIOUtil.java:147) at org.apache.pdfbox.tools.imageio.ImageIOUtil.writeImage(ImageIOUtil.java:129) at org.apache.pdfbox.tools.imageio.TestImageIOUtils.checkSaveResources(TestImageIOUtils.java:84) at org.apache.pdfbox.tools.imageio.TestImageIOUtils.doTestFile(TestImageIOUtils.java:114) at org.apache.pdfbox.tools.imageio.TestImageIOUtils.testRenderImage(TestImageIOUtils.java:272)

See the source code here: https://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/TIFFUtil.java?view=markup&sortby=date

The cause is probably this:

ifd.setAttribute("tagSets", "com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet");

If I change the second parameter to "com.github.jaiimageio.plugins.tiff.BaselineTIFFTagSet" our tests pass. However we can't just change that line to set the github path, because we don't know which jars the users will use (we can't distribute jai_imageio).

stain commented 7 years ago

This jai-imageio-core fork is created specifically to be distributable by open source projects, and is compatible with both GPL3 and Apache License 2.0. (that his however not true for the jai-imageio-jpeg2000 module)

However I agree that this backward compatibility should be there, so I've merged your PR #20. Thanks!