PDF Export Fails with 'Could not initialize class com.sun.imageio.plugins.jpeg.JPEGImageReader' Error

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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:

1 2 3 4 5 6 7 8 9 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.

Solution

See Also

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.