index startup Jahia 7.3 Jahia 8

Unable to start Jahia due to index corruption

Question

Unable to start Jahia with an error similar to the below:

2019-11-13 11:45:58,111: ERROR [localhost-startStop-1] org.apache.jackrabbit.core.RepositoryImpl: Failed to initialize workspace 'default'
javax.jcr.RepositoryException: Unable to initialize query handler: org.apache.jackrabbit.core.query.lucene.JahiaSearchIndex@3774df42
 at org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(RepositoryConfigurationParser.java:666)
.....
Caused by: java.io.EOFException
 at java.io.DataInputStream.readInt(DataInputStream.java:392)
 at org.apache.jackrabbit.core.query.lucene.IndexInfos.read(IndexInfos.java:303)
 at org.apache.jackrabbit.core.query.lucene.IndexInfos.<init>(IndexInfos.java:107)
 at org.apache.jackrabbit.core.query.lucene.MultiIndex.<init>(MultiIndex.java:238)
 at org.apache.jackrabbit.core.query.lucene.SearchIndex.doInit(SearchIndex.java:567)
 at org.apache.jackrabbit.core.query.lucene.JahiaSearchIndex.doInit(JahiaSearchIndex.java:265)

Cause

This issue may be caused by a corrupted index, which can happen due to various reasons such as improper server shutdown, process termination, etc.

Solution

Re-generate the indexes by deleting the old indexes from the below location and restarting Jahia:

  • digital-factory-data/repository / workspaces/default/index
  • digital-factory-data/repository/workspaces/live/index
  • digital-factory-data/repository/index

To minimize this issue, you may enable the automatic consistency check for jackrabbit in jahia.properties: 

jahia.jackrabbit.searchIndex.enableConsistencyCheck = true
#jahia.jackrabbit.searchIndex.forceConsistencyCheck = false
#jahia.jackrabbit.searchIndex.autoRepair = true