PDF Export Fails with 'Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader' Error
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Space PDF Export Fails with 'Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader' Error
Environment
Confluence Server and Data Center.
Diagnosis
- When trying to export a space to PDF, the export hangs and never completes.
- Looking at the
atlassian-confluence.log, we can see the following:
2020-10-30 12:39:02,450 ERROR [Long running task: PDF Space Export] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "PDF Space Export" failed to run.
-- url: /spaces/flyingpdf/doflyingpdf.action | referer: https://localhost/spaces/flyingpdf/flyingpdf.action?key=TEST | traceId: fe4660335bd8ba04 | userName: username | action: doflyingpdf
java.lang.NoClassDefFoundError: Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader
at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:85)
at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:110)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:529)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513)
at com.atlassian.confluence.extra.flyingpdf.impl.LightITextFSImage.updateMeasurements(LightITextFSImage.java:76)
Cause
This error happens when Java is updated without shutting down Confluence first, making the Confluence process point to a Java path that no longer exists, and triggering the NoClassDefFoundError.
Solution
Restart Confluence.