Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG-compressed TIFFs don’t work with Tomcat 7 #482

Open
matthias-ronge opened this issue Jul 26, 2016 · 4 comments
Open

JPEG-compressed TIFFs don’t work with Tomcat 7 #482

matthias-ronge opened this issue Jul 26, 2016 · 4 comments

Comments

@matthias-ronge
Copy link
Collaborator

matthias-ronge commented Jul 26, 2016

When using JPEG-compressed TIFF images, no image is being shown in the metadata editor.

Here are some of the stack traces occurring:

ERROR 2016-07-25 15:49:11,750 de.sub.goobi.metadaten.Metadaten.BildErmitteln(Metadaten.java:1746)
        javax.media.jai.util.ImagingException: All factories fail for the operation "Stream"
Error: One factory fails for the operation "tiff"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor698.invoke(Unknown Source)
[…]
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:781)
    at de.unigoettingen.sub.commons.contentlib.imagelib.ImageManipulator.scaleNextNeighbor(ImageManipulator.java:226)
    at de.unigoettingen.sub.commons.contentlib.imagelib.ImageManager.scaleImageByPixel(ImageManager.java:407)
    at de.unigoettingen.sub.commons.contentlib.imagelib.ImageManager.scaleImageByPixel(ImageManager.java:263)
    at de.unigoettingen.sub.commons.contentlib.imagelib.ImageManager.scaleImageByPixel(ImageManager.java:223)
    at de.sub.goobi.metadaten.MetadatenImagesHelper.scaleFile(MetadatenImagesHelper.java:375)
[…]
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGCodec
    at com.sun.media.jai.codecimpl.TIFFImage.<init>(TIFFImage.java:746)
    at com.sun.media.jai.codecimpl.TIFFImageDecoder.decodeAsRenderedImage(TIFFImageDecoder.java:112)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:96)
    at com.sun.media.jai.opimage.TIFFRIF.create(TIFFRIF.java:53)
    ... 86 more

The class ImageManipulator as part of ics-1.1.5.jar makes use of Java Advanced Imaging (jai_core-1.1.2_01.jar) which tries to call functionality from the com.sun.image.codec.jpeg package which has been removed in Java 1.7. Cf. Java SE 7 and JDK 7 Compatibility:

Some APIs in the sun.* packages have changed. These APIs are not intended for use by developers. Developers importing from sun.* packages do so at their own risk. For more details, see Why Developers Should Not Write Programs That Call sun.* Packages.

@henning-gerhardt
Copy link
Collaborator

Does this happen even with uncompressed tif files or only with JPEG compressed tif files?

@matthias-ronge
Copy link
Collaborator Author

No, the problem occurs only for JPEG-compressed TIFFs.

@henning-gerhardt
Copy link
Collaborator

I will label this as bug. But as we don't have source files for ics-1.1.5.jar I see no way for a fast solution.

@matthias-ronge
Copy link
Collaborator Author

Java Advanced Imaging API 1.1.2_01 already is the latest release. As to my above findings, I consider it broken in Java 7 onwards.

Reading of images can be done using javax.imageio.ImageIO, but it does not support TIFF out of the box. However, the TwelveMonkeys library provides a TIFF reader (and many others) to be used with ImageIO to read (and write) a lot of image formats. It’s licensed under the BSD 3-clause license which is compatible with GPL.

BTW, the way of writing temporary image files into the web application directory to expose their content via HTTP can be considered a mistake, too. If this gets rewritten, <p:graphicImage> should be used to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants