Creating a review in Crucible fails - failed to lazily initialize a collection of role
Problem
Attempting to create a review fails with a modal window containing the following message:
Error
Server Error
Error 2
URL: /json/cru/TEST-1/loadFrxAjax
A javax.servlet.ServletException was encountered
javax.el.ELException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.cenqua.crucible.model.CrucibleRevision.otherDetails, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.cenqua.crucible.model.CrucibleRevision.otherDetails, no session or session was closed
failed to lazily initialize a collection of role: com.cenqua.crucible.model.CrucibleRevision.otherDetails, no session or session was closed
The following appears in the atlassian-fisheye-YYYY-MM-DD.log
2016-01-12 09:45:38,465 ERROR [qtp1383519982-42789 ] org.hibernate.LazyInitializationException LazyInitializationException-<init> - failed to lazily initialize a collection of role: com.cenqua.crucible.model.CrucibleRevision.otherDetails, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.cenqua.crucible.model.CrucibleRevision.otherDetails, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)
at org.hibernate.collection.AbstractPersistentCollection.readElementByIndex(AbstractPersistentCollection.java:176)
at org.hibernate.collection.PersistentMap.get(PersistentMap.java:169)
at com.cenqua.crucible.model.CrucibleRevision$DetailsMap.get(CrucibleRevision.java:679)
at com.cenqua.crucible.model.CrucibleRevision$DetailsMap.get(CrucibleRevision.java:607)
at com.cenqua.crucible.model.CrucibleRevision.getDetail(CrucibleRevision.java:428)
at com.cenqua.crucible.view.FRXDO.isDiffable(FRXDO.java:786)
...
Cause
In the same daily log you will see the same web request log the following error:
2016-01-12 09:45:38,428 ERROR [qtp1383519982-42789 ] fisheye UploadManager-createFileForUploadItem - Could not create upload directory: /opt/atlassian/fecru/data/var/data/uploads/02/41
2016-01-12 09:45:38,429 WARN [qtp1383519982-42789 ] fisheye DefaultContentManager-tryStoreRevision - Couldn't store revision test/test_file.txt : 17018 (51543)
java.lang.RuntimeException: java.io.IOException: Could not create directory to store upload.
...
Caused by: java.io.IOException: Could not create directory to store upload.
... 287 more
Resolution
Update the folder permissions on the path referenced in the error message so that the user running the application can write. Your permissions requirements might be more strict than the following example and a recursive call to the root of the of the uploads folder might take some time to complete depending on the amount of data:
chmod -R u+w /opt/atlassian/fecru/data/var/data/uploads