my dog learned polymorphism
The moose likes Other Open Source Projects and the fly likes Search using Lucene: Unknown format version: -4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Search using Lucene: Unknown format version: -4" Watch "Search using Lucene: Unknown format version: -4" New topic

Search using Lucene: Unknown format version: -4

Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
Hi All,

Hope this is the right forum to post this question.

I have created a search application using Lucene, which works very well as a standalone application. However, when i try to call the search application from a servlet, i am getting the below exception. I am not very clear on the exception and hence i am not able to think of a remedy beyond certain level. Therefore, if anybody encountered similar problem; could you please share your experience, expecially on the exception itself and on the resolution part of it. The application details are,

Tomcat server 5.5.26
Java 1.5.15
Lucene 2.3.1

Here is the exception.

Searching starts...
Index directory =\EclipseProjects\KnowledgeBase\docbase Unknown format version: -4
at org.apache.lucene.index.IndexReader$1.doBody(
at org.apache.lucene.index.SegmentInfos$
at com.kb.servlet.SearchServlet.doPost(
at com.kb.servlet.SearchServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$

Thanks a lot for your help.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Not sure if that's the problem, but make sure that the Lucene version used to create the index is the same that's being used to read it.
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
Hi Ulf,

Thanks a lot, you suggestion works. There was old version of lucene jar file in my tomcat directory. I removed the old version, it works now.

thanks again.

thanks and regards,
I agree. Here's the link:
subject: Search using Lucene: Unknown format version: -4
It's not a secret anymore!