Sunday 27 July 2014

Instance does not start caused by Access is denied / Bad file descriptor


Namastey,

Sometimes the instance doesn't start up and you recieve following error :

*INFO* [FelixStartLevel] com.day.crx.persistence.tar.TarSet scanning index E:\adobe-cq.5.5.0\Author\crx-quickstart\.\repository\workspaces\crx.default\data_04935.tar id:4945 length:102764544 append:-1 1898032864

 *ERROR* [FelixStartLevel] org.apache.jackrabbit.core.RepositoryImpl Failed to initialize workspace 'crx.default' javax.jcr.RepositoryException: Cannot instantiate persistence manager com.day.crx.persistence.tar.TarPersistenceManager
at com.day.crx.core.CRXRepositoryImpl$CRXWorkspaceInfo.createPersistenceManager(CRXRepositoryImpl.java:1290)
..
        ...
Caused by: java.io.IOException: Access is denied
at java.io.RandomAccessFile.writeBytes(Native Method)
at java.io.RandomAccessFile.write(Unknown Source
... 59 more

*ERROR* [FelixStartLevel] org.apache.jackrabbit.core.RepositoryImpl Unable to start repository, forcing shutdown...

In Linux machine, you will get
Caused by: java.io.IOException: Bad file descriptor

Theis error stack is due to inconsistencies between index_*.tar and data_*.tar files.

Solution 

0/ Stop the instance.
1/ Go to path as per *INFO* e.g. repository\workspaces\crx.default\data_04935.tar
2/ Change the permission of data_xxx.tar file to read write. 
    a) In windows , just right click on the tar file and uncheck readonly.
    b) In Linux , use chmod command to set file permissions right again
3/ Delete the index_*.tar and locks file present in the folder.
4/ Open the workspace.xml add parameters in searchindex tag as following  to check ,fix consistency and rebuilding of indexes.

<SearchIndex class="com.day.crx.query.lucene.LuceneHandler">
    <param name="path" value="${wsp.home}/index"/>
    <param name="enableConsistencyCheck" value="true"/>
    <param name="forceConsistencyCheck" value="true"/>
    <param name="autoRepair" value="true"/>

</SearchIndex>

5/ Restart the instance and tail the logs.
6/ Once the issue is resolved remove the parameters added in step 4 so that the consistency check doesn't run on every start of instance.

Dhanywaad,

2 comments:

  1. Do you know why AEM changes the permissions for the data_xxx.tar files to 'read' in the first place?

    ReplyDelete
  2. Casino Site Review - Lucky Club Live
    Casino Site Review · Up to 20 Free Spins · Player Discussion · Player Discussion · Player Discussion · Player Discussion · Player Discussion. Rating: 3.5 luckyclub.live · ‎Review by luckyclub.live

    ReplyDelete

Basic Sling Model Exporter

/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...