NullPointerException at javax.mail.internet.MimeUtility.getEncoding When Exporting Page to Word

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

Symptoms

Exporting a page to Word results in this browser error:

(Auto-migrated image: description temporarily unavailable)

The following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 2013-06-03 23:38:52,775 ERROR [http-8512-5] [ContainerBase.[Standalone].[localhost].[/c512]] log Unhandled exception occurred whilst decorating page -- url: /c512/exportword | userName: admin | referer: http://localhost:8512/c512/display/ds/testdasdsa java.lang.NullPointerException at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:226) at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:299) at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1375) at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021) at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419) at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1354) at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2107) at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2075) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1770) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1749) at com.atlassian.confluence.servlet.ExportWordPageServer.service(ExportWordPageServer.java:188)

Cause

There are broken remote images in the page (images linked from the web that can no longer be loaded - image may have been moved, removed, or the server hosting the image may be down). Editing the page again to try to remove the broken image is not possible, as the image will be "hidden".

Resolution

  1. Install the Confluence Source Editor

  2. Edit the page, then click on the <> button on the top right corner of the editor

  3. Look for the broken image, example:

    1 2 3 <ac:image> <ri:url ri:value="http://localhost:8420/c42/download/attachments/589826/global.logo"/> </ac:image>
  4. Remove the broken image tags, or change the link to a valid link for the image (if the image have been moved)

  5. Hit Apply, and save the page

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.