File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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 = org.apache.lucene.store.FSDirectory@D:\EclipseProjects\KnowledgeBase\docbase
java.io.IOException: Unknown format version: -4
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:195)
at org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:152)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:579)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:147)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:142)
at org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:48)
at com.kb.logic.IndexSearch.search(IndexSearch.java:31)
at com.kb.servlet.SearchServlet.doPost(SearchServlet.java:62)
at com.kb.servlet.SearchServlet.doGet(SearchServlet.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

Thanks a lot for your help.

Regards,
ravi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
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,
ravi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Search using Lucene: Unknown format version: -4
 
Similar Threads
java.lang.SecurityException
Error while trying to construct excel sheet..!
Passing Date in Callable Statement
XML Exception
problem in relative path in jsp page