NullPointerException on calculateLastModifiedDate Due to Null Value in Attachments Table
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
This only applies to versions of Confluence 5.5 and below unless the attachments were never migrated to disk which is now default and automatically migrated in any subsequent upgrade with a specific task.
Symptoms
The following appears in the atlassian-confluence.log
:
1
2
3
4
5
6
7
8
9
10
11
12
2008-11-03 12:41:27,120 ERROR [http-9080-Processor2] [[Standalone].\[localhost].[].[file-server]] invoke Servlet.service() for servlet file-server threw exception
java.lang.NullPointerException
at com.atlassian.plugin.servlet.util.LastModifiedHandler.calculateLastModifiedDate(LastModifiedHandler.java:54)
at com.atlassian.plugin.servlet.util.LastModifiedHandler.checkRequest(LastModifiedHandler.java:71)
at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:89)
at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload$StreamResultCallback.doInTransaction(ServeAfterTransactionDownload.java:129)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload.getStreamInTransaction(ServeAfterTransactionDownload.java:41)
at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload.serveFile(ServeAfterTransactionDownload.java:47)
at com.atlassian.plugin.servlet.BaseFileServerServlet.doGet(BaseFileServerServlet.java:77)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Cause
This error can occur if your attachments.lastmoddate database table row contains invalid or null records.
Resolution
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Populating the rows in attachments.lastmoddate with some valid dates.
Was this helpful?