lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Cannot instantiate SPI class: org.apache.lucene.codecs.lucene42.Lucene42Codec
Date Tue, 09 Apr 2013 12:33:03 GMT
There may be 2 problems, to fix:
a) use 4.2.1 (if you are using custom class loaders in your application)
b) The stack trace says, that it can only find the codec "Facet42". This codec is only in
lucene-facet.jar, but this JAR file is not in your classpath. So you seem to have some classpath
problem.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Manivannan Selvadurai [mailto:manivannan@unmetric.com]
> Sent: Tuesday, April 09, 2013 1:15 PM
> To: java-user@lucene.apache.org
> Subject: Re: Cannot instantiate SPI class:
> org.apache.lucene.codecs.lucene42.Lucene42Codec
> 
> i don't get what u mean by setup. im not using solr. Could u please be more
> specific.
> we dont use maven for building the jar. Its just few build.xmls. It is just plain
> Lucene 4.2.
> I have to create an index using some tokenizers and filters.
> 
> with thanks,
> Manivannan
> 
> 
> On Tue, Apr 9, 2013 at 4:07 PM, Uwe Schindler <uwe@thetaphi.de> wrote:
> 
> > As mentioned in the original answer, what is the setup you are using?
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >
> > > -----Original Message-----
> > > From: Manivannan Selvadurai [mailto:manivannan@unmetric.com]
> > > Sent: Tuesday, April 09, 2013 12:33 PM
> > > To: java-user@lucene.apache.org
> > > Subject: Re: Cannot instantiate SPI class:
> > > org.apache.lucene.codecs.lucene42.Lucene42Codec
> > >
> > > I dint understand what u mean by directly inside ant or just for
> > compiling, but
> > > this is the process we do Im using the Lucene jars in a build.xml
> > > and we
> > use
> > > ant to build the jar and i invoke the program on that resulting jar.
> > >
> > >
> > > So will using lucene 4.2.1 fix the issue for me?
> > >
> > >
> > > On Tue, Apr 9, 2013 at 3:50 PM, Uwe Schindler <uwe@thetaphi.de>
> wrote:
> > >
> > > > 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: uwe@thetaphi.de
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Manivannan Selvadurai [mailto:manivannan@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>(LiveIndexWriter
> > > > > Confi
> > > > > g.java:118)
> > > > >         at
> > > > >
> org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.j
> > > > > ava: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(NativeConstruc
> > > > > tor
> > > > > AccessorImpl.java:39)
> > > > >         at
> > > > >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegating
> > > > > Con
> > > > > 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-unsubscribe@lucene.apache.org
> > > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > *With Best Regards,*
> > > *Manivannan *
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> 
> 
> --
> *With Best Regards,*
> *Manivannan *


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message