tags:

views:

107

answers:

3

How to handle this error in lucene:

java.lang.AbstractMethodError: org.apache.lucene.store.Directory.listAll()[Ljava/lang/String;
        at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:568)
        at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:69)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:188)

I am making a lucene function call but unfortunately it itself calls an abstract method of some class, as is evident from the error above. What is the work around for this?

Thanks, Akhil

+3  A: 

An AbstractMethodError can only occur when a class definition has changed incompatibly, so it looks like you're using an incompatible combination of JARs of different parts of Lucene. Try updating all your Lucene JARs to the latest version.

Michael Borgwardt
You are right! I am using lucene-core-3.0.0 and another hadoop-contrib-index.jar that I got with hadoop-0.19.0 a year ago. Probably at that time lucene had some otehr version. I will try to get new jar for hadoop-contrib-index. let's see if that works. Thanks!
Akhil
A: 

Another option is that something bad happened to your index - either it was built using a different version of Lucene, or a file is missing. Try opening the index using luke.

Yuval F
Nah, that couldn't cause an AbstractMethodError.
Michael Borgwardt
A: 

Ok! I found the answer. It was not the problem of version mismatch. Rather the hadoop contrib's FileSystemDirectory which extends abstract class Directory did not implement the abstract function listAll(). listAll() function was being called by lucene indexReader.open() function. I added this function and it is up and running now.

Thanks

Akhil