Copying pages in Confluence fails with NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

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

Problem

When trying to copy an existing Confluence page, the following ERROR occurs in atlassian-confluence.log:

2015-06-05 11:21:00,803 ERROR [http-bio-8090-exec-10] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: test.png v.1 (36971334)
2015-06-05 11:21:00,814 ERROR [http-bio-8090-exec-10] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- referer: https://test.com/wiki/display/TEST/test | url: /wiki/pages/copypage.action | userName: t875571
java.lang.NullPointerException: inputStream cannot be null
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
	at com.atlassian.confluence.pages.persistence.dao.AttachmentDataStream$InputStreamWrapper.<init>(AttachmentDataStream.java:43)
	at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.rawBinaryWrapper(FileSystemAttachmentDataDao.java:155)


Cause

The attachment has been deleted from the filesystem but the attachment is still referenced by the page the user tried to copy. 

Workaround 

Delete the attachment reference from the database.

This is only applicable for Confluence 5.7.x and above.


Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.


  1. Shut down Confluence.

  2. Identify the ID of the attachment that needs to be deleted. From the example above, the ID would be "36971334"

    2015-06-05 11:21:00,803 ERROR [http-bio-8090-exec-10] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: test.png v.1 (36971334)
  3.  Run the queries below to delete the attachment (replacing the contentid number with the number from the error):

    delete from contentproperties where CONTENTID = 36971334;
    delete from content where contentid = 36971334;
  4. Restart Confluence.


Last modified on Nov 14, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.