This may be fixed in 4.2.1, but this depends on your setup. Are you using Lucene directly inside ANT or is it just for compiling code?
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Manivannan Selvadurai [mailto:manivan...@unmetric.com] > Sent: Tuesday, April 09, 2013 11:52 AM > To: java-user@lucene.apache.org > Subject: Cannot instantiate SPI class: > org.apache.lucene.codecs.lucene42.Lucene42Codec > > Hi All, > > I'm facing this problem. > When i build a jar out of my project and try to run the program that invokes > lucene part of the code, it gives me this exception > > Exception in thread "main" java.util.ServiceConfigurationError: Cannot > instantiate SPI class: org.apache.lucene.codecs.lucene42.Lucene42Codec > at > org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:72) > at > org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:42) > at > org.apache.lucene.util.NamedSPILoader.<init>(NamedSPILoader.java:37) > at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:41) > at > org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfi > g.java:118) > at > org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:1 > 45) > Caused by: java.lang.IllegalArgumentException: A SPI class of type > org.apache.lucene.codecs.DocValuesFormat with name 'Lucene42' does not > exist. You need to add the corresponding JAR file supporting this SPI to your > classpath.The current classpath supports the following names: [Facet42] > at > org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:104) > at > org.apache.lucene.codecs.DocValuesFormat.forName(DocValuesFormat.jav > a:97) > at > org.apache.lucene.codecs.lucene42.Lucene42Codec.<init>(Lucene42Codec.j > ava:130) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor > AccessorImpl.java:39) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon > structorAccessorImpl.java:27) > at java.lang.reflect.Constructor.newInstance(Constructor.java:513) > at java.lang.Class.newInstance0(Class.java:357) > at java.lang.Class.newInstance(Class.java:310) > at > org.apache.lucene.util.NamedSPILoader.reload(NamedSPILoader.java:62) > ... 7 more > > > > I have the entry in build.xml like this > > *<path id="LuceneV4.2.userclasspath">* > * <pathelement location="../libs/luceneV4.2/commons-codec- > 1.7.jar"/>* > * <pathelement > location="../libs/luceneV4.2/commons-compress-1.4.1.jar"/>* > * <pathelement location="../libs/luceneV4.2/icu4j-49.1.jar"/>* > * <pathelement location="../libs/luceneV4.2/jakarta-regexp-1.4.jar"/> > * > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-common-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-icu-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-kuromoji-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-morfologik-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-phonetic-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-smartcn-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-stempel-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-analyzers-uima-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-benchmark-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-classification-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-codecs-4.2.0.jar"/>* > * <pathelement location="../libs/luceneV4.2/lucene-core-4.2.0.jar"/>* > * <pathelement location="../libs/luceneV4.2/lucene-facet-4.2.0.jar"/> > * > * <pathelement > location="../libs/luceneV4.2/lucene-grouping-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-highlighter-4.2.0.jar"/>* > * <pathelement location="../libs/luceneV4.2/lucene-join-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-memory-4.2.0.jar"/>* > * <pathelement location="../libs/luceneV4.2/lucene-misc-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-queries-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-queryparser-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-sandbox-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-spatial-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/lucene-suggest-4.2.0.jar"/>* > * <pathelement > location="../libs/luceneV4.2/morfologik-fsa-1.5.5.jar"/>* > * <pathelement > location="../libs/luceneV4.2/morfologik-polish-1.5.5.jar"/>* > * <pathelement > location="../libs/luceneV4.2/morfologik-stemming-1.5.5.jar"/>* > * <pathelement location="../libs/luceneV4.2/nekohtml-1.9.17.jar"/>* > * <pathelement location="../libs/luceneV4.2/spatial4j-0.3.jar"/>* > * <pathelement location="../libs/luceneV4.2/Tagger-2.3.1.jar"/>* > * <pathelement location="../libs/luceneV4.2/uimaj-core-2.3.1.jar"/>* > * <pathelement > location="../libs/luceneV4.2/WhitespaceTokenizer-2.3.1.jar"/>* > * <pathelement location="../libs/luceneV4.2/xercesImpl-2.9.1.jar"/>* > * </path>* > > > Please Help. > > -- > *With Best Regards,* > *Manivannan * --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org