This exception happened in the two versions (2.4.1 and 2.9). The code is this:
package main; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.TermVector; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.LockObtainFailedException; import br.ufrj.cos.lucene.index.signal.SignalIndexProcessor; import br.ufrj.cos.lucene.index.trivial.TrivialIndexProcessor; /** * @author fabricio * */ public class Main { private static final String INDEX_DIR = "index"; private static final String DOCS_DIR = "docs"; /** * @param args */ public static void main(String[] args) { IndexWriter writer = null; TrivialIndexProcessor trivialProcessor = null; File dirIndex = new File(INDEX_DIR); if (dirIndex.exists()) { dirIndex.delete(); } dirIndex.mkdir(); try { // FIXME: quando avançar a versão do Lucene, a instanciação da // variável writer deverá ser feita pelas linhas comentadas abaixo. // writer = new IndexWriter(FSDirectory.open(dirIndex), // new StandardAnalyzer(Version.LUCENE_CURRENT), true, // IndexWriter.MaxFieldLength.UNLIMITED); Analyzer analyzer = new StandardAnalyzer(); FSDirectory directory = FSDirectory.getDirectory(dirIndex); writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } // ... } } On Wed, Jul 29, 2009 at 12:25 PM, Uwe Schindler <u...@thetaphi.de> wrote: > So whats your problem now: You get this error with 2.9 or 2.4.1? 2.9 is > backwards compatible and also supports FSDir.getDirectory(), too. > > Can you please send your code and the exact specification what happens with > which version of lucene and against which version it was compiled. Maybe it > is a backwards compatibility bug. > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -----Original Message----- > > From: Fabrício Raphael [mailto:fabricio...@gmail.com] > > Sent: Wednesday, July 29, 2009 5:22 PM > > To: java-user@lucene.apache.org > > Subject: Re: Exception: java.lang.NoSuchMethodError: > > org.apache.lucene.store.FSDirectory.getDirectory > > > > I don't have the .jar of other lucene version. > > > > But, in a moment I used the code of the lucene 2.9dev, that is at the > svn, > > in my classpath. And after I return to use the lucene-core-2.4.1.jar. > > With the code of the svn, I did other code to get the Directory instance, > > and it was work. > > The code follow: > > FSDirectory.open(dirIndex); > > > > But, I want to return to use the lucene 2.4.1, because at the 2.9 the > > structure the similarity, score and collecters is much different to 2.4. > > and > > I need customize starting as a baseline on the structure. > > > > Thanks! > > > > On Wed, Jul 29, 2009 at 11:56 AM, Simon Willnauer < > > simon.willna...@googlemail.com> wrote: > > > > > If I recall it correctly this method was introduced in Lucene 2.1. I > > > agree with Ian you must have a different lucene version in your > > > classpath. Maybe you added the jar to the JDK's / JRE's ext directory > > > or some other obscure place?! > > > > > > simon > > > > > > On Wed, Jul 29, 2009 at 4:52 PM, Ian Lea<ian....@gmail.com> wrote: > > > > You've probably got some other version of lucene somewhere in the > > > > classpath, one that doesn't have that method in that class. It is > > > > there in 2.4.1, wasn't there in 1.4.3, so no doubt appeared somewhere > > > > in between. And is deprecated in 2.9-dev. > > > > > > > > > > > > -- > > > > Ian. > > > > > > > > > > > > 2009/7/29 Fabrício Raphael <fabricio...@gmail.com>: > > > >> Hi! > > > >> > > > >> I'm with a error follow: > > > >> java.lang.NoSuchMethodError: > > > >> > > > > > > org.apache.lucene.store.FSDirectory.getDirectory(Ljava/io/File;)Lorg/apach > > e/lucene/store/FSDirectory; > > > >> > > > >> In the code: > > > >> File dirIndex = new File("index"); > > > >> if (dirIndex.exists()) { > > > >> dirIndex.delete(); > > > >> } > > > >> dirIndex.mkdir(); > > > >> FSDirectory directory = FSDirectory.getDirectory(dirIndex); // > > exception > > > >> here > > > >> > > > >> Obs.: The lucene-core-2.4.1.jar is in the classpath of the my > > project. > > > >> > > > >> Can you help me with this exception? > > > >> > > > >> Now, thanks! > > > >> > > > >> -- > > > >> Fabrício Raphael Silva Ferreira > > > >> > > > >> home page: > > http://www.cos.ufrj.br/~fabriciorsf/<http://www.cos.ufrj.br/%7Efabriciorsf/> > <http://www.cos.ufrj.br/%7Efabriciorsf > > /> > > > >> > > > >> Mestrando em Engenharia de Sistemas e Computação > > > >> Linha de Pesquisa: Banco de Dados > > > >> Programa de Engenharia de Sistemas e Computação > > > >> Universidade Federal do Rio de Janeiro > > > >> PESC/COPPE/UFRJ > > > >> > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > > > > > > > > -- > > Fabrício Raphael > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > -- Fabrício Raphael Silva Ferreira home page: http://www.cos.ufrj.br/~fabriciorsf/ Mestrando em Engenharia de Sistemas e Computação Linha de Pesquisa: Banco de Dados Programa de Engenharia de Sistemas e Computação Universidade Federal do Rio de Janeiro PESC/COPPE/UFRJ Atenção! Proteja meu endereço como estou protegendo o seu. Ao enviar cópias, não use o campo "Para:"ou "Cc:"(cópia carbono), use sempre o campo "Cco:" (cópia carbono oculta) ou "Bcc" (Blind carbon copy=cópia carbono oculta), e também apague o endereço de quem lhe enviou o e-mail que você está passando adiante. Assim o e-mail de todos estará preservado. Obrigado!