Confluence Page Attachments Fail to Load with a File.IO Error

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

When clicking on any attachment, the following stack trace appears:

2010-03-29 17:38:21,441 ERROR [http-8080-2] [[Catalina].[localhost].[/confluence].[file-server]] log Servlet.service() for servlet file-server threw exception
java.lang.NullPointerException
	at java.io.File.<init>(File.java:222)
	at com.atlassian.confluence.pages.persistence.dao.BootstrapAttachmentLocationResolver.getFileLocation(BootstrapAttachmentLocationResolver.java:18)
	at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.getConfluenceAttachmentDirectory(FileSystemAttachmentDataDao.java:62)
	at com.atlassian.confluence.pages.persistence.dao.HierarchicalFileSystemAttachmentDataDao.getConfluenceAttachmentDirectory(HierarchicalFileSystemAttachmentDataDao.java:75)
	at com.atlassian.confluence.pages.persistence.dao.HierarchicalFileSystemAttachmentDataDao.getDirectoryForAttachmentContainer(HierarchicalFileSystemAttachmentDataDao.java:66)
	at com.atlassian.confluence.pages.persistence.dao.HierarchicalFileSystemAttachmentDataDao.getDirectoryForAttachment(HierarchicalFileSystemAttachmentDataDao.java:40)
	at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.getLatestAttachmentFile(FileSystemAttachmentDataDao.java:67)
	at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.getDataForAttachment(FileSystemAttachmentDataDao.java:86)
	at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.getAttachmentData(AbstractHibernateAttachmentDao.java:151)
	at com.atlassian.confluence.pages.attachments.CachingAttachmentDao.getAttachmentData(CachingAttachmentDao.java:133)
...
	at com.atlassian.confluence.importexport.resource.AttachmentDownloadResourceReader.getStreamForReading(AttachmentDownloadResourceReader.java:45)
	at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:156)
	...

Attempting to attach any file in Confluence failed and following stack trace appears:

2014-06-13 21:43:22,903 ERROR [http-bio-8090-exec-2] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- referer: http://localhost:8090/pages/viewpageattachments.action?pageId=688132 | url: /pages/doattachfile.action | userName: admin
java.lang.NullPointerException
    at java.io.File.<init>(File.java:277)
    at com.atlassian.confluence.pages.persistence.dao.BootstrapAttachmentLocationResolver.getFileLocation(BootstrapAttachmentLocationResolver.java:18)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.getConfluenceAttachmentsDirectory(FileSystemAttachmentDataDao.java:56)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.access$000(FileSystemAttachmentDataDao.java:33)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao$1.getFileLocation(FileSystemAttachmentDataDao.java:49)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.getRootDirectory(HierarchicalMultiStreamAttachmentDataFileSystem.java:284)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.getDirectoryForSpace(HierarchicalMultiStreamAttachmentDataFileSystem.java:279)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.getContentEntityDirectory(HierarchicalMultiStreamAttachmentDataFileSystem.java:271)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.getContainerDirectoryForAttachmentVersions(HierarchicalMultiStreamAttachmentDataFileSystem.java:131)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.getAttachmentDataFile(HierarchicalMultiStreamAttachmentDataFileSystem.java:308)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem.saveAttachmentData(HierarchicalMultiStreamAttachmentDataFileSystem.java:96)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:185)
    at com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:150)
    at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.saveNewAttachment(AbstractHibernateAttachmentDao.java:210)

Cause

The confluence.cfg.xml file is missing a line or is corrupt.

Resolution

  1. Stop Confluence.
  2. Back up your Confluence home directory. The <confluence_home> directory is the path defined in the following file: <confluence_install>/confluence/WEB-INF/classes/confluence-init.properties
  3. Examine confluence.cfg.xml and check that the attachments.dir property looks like this:

        <property name="attachments.dir">${confluenceHome}/attachments</property>
    

    See the bug report  CONF-19171 - Getting issue details... STATUS  to improve the handling of this error.

  4. Start Confluence.
Last modified on Apr 7, 2016

Was this helpful?

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