We are upgraded JIRA from 5.2.10 to 6.3.15. In this process we have to upgrade the plugin to make it compatible to JIRA 6.3.15. For that i am using Lucene-core,lucene-analyzers 3.3.0 release.
when i install the plugin i am seeing the error trace as follows:
org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.MMapDirectory@/data/jira-data/caches/indexes/jira-clearcase-indexes lockFactory=org.apache.lucene.store.NativeFSLockFactory@61812f0c: files: [_0.fdt, _0.fdx, write.lock]
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:708)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:75)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:428)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:288)
at org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:89)
at net.sf.jiraext.plugin.clearcase.services.ClearCaseRevisionIndexer.hasDocument(ClearCaseRevisionIndexer.java:297)
at net.sf.jiraext.plugin.clearcase.services.ClearCaseRevisionIndexer.updateIndexes(ClearCaseRevisionIndexer.java:218)
at net.sf.jiraext.plugin.clearcase.services.ClearCaseIndexService.run(ClearCaseIndexService.java:160)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:66)
at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:75)
at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:53)
at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:36)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
package net.sf.jiraext.plugin.clearcase.services; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.Iterator; import java.util.List; import net.sf.jiraext.plugin.clearcase.ClearCaseRevision; import net.sf.jiraext.plugin.clearcase.IClearCaseRevisionIndexer; import net.sf.jiraext.plugin.clearcase.IConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.index.LogDocMergePolicy; import org.apache.lucene.index.LogMergePolicy; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.Version; import com.atlassian.jira.issue.index.IndexException; import com.atlassian.jira.util.JiraKeyUtils; public class ClearCaseRevisionIndexer implements IClearCaseRevisionIndexer { private static Log log = LogFactory.getLog(ClearCaseRevisionIndexer.class); private static final StandardAnalyzer ANALYZER = new StandardAnalyzer(Version.LUCENE_33); private String indexPath; private void createIndex() throws IndexException, IOException { if (log.isDebugEnabled()) { log.info("ClearCase Index Creation Starting"); } if (indexPath == null) { String msg = "field '" + indexPath + "' is null"; throw new IndexException(msg); } File indexDir = new File(indexPath); indexDir.mkdirs(); if (log.isDebugEnabled()) { log.info("ClearCase Index Directory '" + indexPath + "' Created"); } } public String getIndexPath() { return indexPath; } /** * @param indexPath */ public synchronized void setIndexPath(String indexPath) { this.indexPath = indexPath; } /** * @param revisionList */ public synchronized void updateIndexes(List revisionList) throws Exception { IndexWriter writer = null; IndexWriterConfig writerConfig = null; try { File indexDir = new File(indexPath); if (indexDir.exists() == false) { createIndex(); } writerConfig = new IndexWriterConfig(Version.LUCENE_33, ANALYZER); writer = new IndexWriter(FSDirectory.open(indexDir), writerConfig); LogMergePolicy logMrPolicy = new LogDocMergePolicy(); logMrPolicy.setUseCompoundFile(false); ClearCaseRevision[] revisions = (ClearCaseRevision[]) revisionList.toArray(new ClearCaseRevision[revisionList.size()]); for (int i = 0; i < revisions.length; ++i) { Document doc = new Document(); String committer = revisions[i].getCommitter(); if (committer != null) { doc.add(new Field(IConstants.FIELD_COMMITTER, committer, Field.Store.YES, Field.Index.NOT_ANALYZED)); } String element = revisions[i].getElement(); if (element != null) { doc.add(new Field(IConstants.FIELD_ELEMENT, element, Field.Store.YES, Field.Index.NOT_ANALYZED)); } String version = revisions[i].getVersion(); if (version != null) { doc.add(new Field(IConstants.FIELD_VERSION, version, Field.Store.YES, Field.Index.NOT_ANALYZED)); } Date date = revisions[i].getDate(); if (date != null) { doc.add(new Field(IConstants.FIELD_DATE, "" + date.getTime(), Field.Store.YES, Field.Index.NOT_ANALYZED)); } String comment = revisions[i].getComment(); if (comment != null) { doc.add(new Field(IConstants.FIELD_COMMENT, comment, Field.Store.YES, Field.Index.NOT_ANALYZED)); } String trackingAttributes = revisions[i].getAttributes(); if (trackingAttributes != null) { List keys = JiraKeyUtils.getIssueKeysFromString(trackingAttributes); for (Iterator j = keys.iterator(); j.hasNext();) { String key = (String) j.next(); doc.add(new Field(IConstants.FIELD_ISSUE_KEY, key, Field.Store.YES, Field.Index.NOT_ANALYZED)); } } if (!hasDocument(committer, comment, date, element, version)) { writer.addDocument(doc); } } } catch (Exception e) { e.printStackTrace(); log.error(e); throw e; } finally { if (writer != null) { try { //writer.optimize(); writer.close(); } catch (IOException e1) { String msg = ""; log.error(msg, e1); } writer = null; } } } /** * @param vobName * @param committer * @param comment * @param date * @param element * @param version * @return */ public synchronized boolean hasDocument(String committer, String comment, Date date, String element, String version) { boolean status = false; // to work with the cases where vob name is not present Query committerQuery = new TermQuery(new Term(IConstants.FIELD_COMMITTER, committer)); Query commentQuery = new TermQuery(new Term(IConstants.FIELD_COMMENT, comment)); Query dateQuery = new TermQuery(new Term(IConstants.FIELD_DATE, "" + date.getTime())); Query elementQuery = new TermQuery(new Term(IConstants.FIELD_ELEMENT, element)); Query versionQuery = new TermQuery(new Term(IConstants.FIELD_VERSION, version)); BooleanQuery query = new BooleanQuery(); query.add(committerQuery, BooleanClause.Occur.MUST); query.add(commentQuery, BooleanClause.Occur.MUST); query.add(dateQuery, BooleanClause.Occur.MUST); query.add(elementQuery, BooleanClause.Occur.MUST); query.add(versionQuery, BooleanClause.Occur.MUST); IndexSearcher searcher = null; try { searcher = new IndexSearcher(FSDirectory.open((new File(indexPath)))); TopDocs hits = searcher.search(query,null,10000); // change the code to get TotalHitCountCollector using Collector class if (hits.totalHits == 1) { status = true; } else { status = false; } } catch (IOException e) { e.printStackTrace(); String msg = ""; log.error(msg, e); } finally { try { if (searcher != null) { searcher.close(); } } catch (IOException e1) { String msg = ""; log.error(msg, e1); } } return status; } }
Community moderators have prevented the ability to post new answers.
The exception is thrown by this line:
searcher = new IndexSearcher(FSDirectory.open((new File(indexPath))));
Do you set valid path through setIndexPath method? Does JIRA has permissions to create a new file under this path?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.