Hi,

You have to use the official Lucene JAR file (e.g., as downloadable from 
Maven). If you constructed your own JAR file variant, it may miss important 
metadata in the META-INF/services folder of the JAR file. This also happens 
with some Uber-JAR producers (Maven Shade plugin, JarJar,...), so the 
recommendation is to not use such tools unless you know how to correctly use 
them (so they preserve and merge the META-INF/services folder inside the JAR 
file).

Uwe

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

> -----Original Message-----
> From: David Yanay [mailto:da...@smartmediamarketing.net]
> Sent: Sunday, July 12, 2015 8:30 AM
> To: java-user@lucene.apache.org
> Subject: Classpath issue
> 
> Hello,
> 
> I'm trying to use Lucene 5.2.1 in my project. While trying to invoke the
> following code
> 
> Analyzer analyzer = new EnglishAnalyzer(); IndexWriterConfig iwc = new
> IndexWriterConfig(analyzer)
> 
> I encounter the following error:
> java.lang.ExceptionInInitializerError
> at org.apache.lucene.codecs.Codec.getDefault(Codec.java:140)
> at
> org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfi
> g.java:115)
> at
> org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:1
> 63)
> My own dode from here
> ... 23 more
> Caused by: java.lang.IllegalArgumentException: An SPI class of type
> org.apache.lucene.codecs.Codec with name 'Lucene50' does not exist.  You
> need to add the corresponding JAR file supporting this SPI to your classpath.
> The current classpath supports the following names: [] at
> org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)
> at org.apache.lucene.codecs.Codec$Holder.<clinit>(Codec.java:60)
> ... 27 more
> 
> I added the following src code to my project without any other jars:
> lucene-5.2.1/analysis/common/src/java/org/tartarus org/tartarus lucene-
> 5.2.1/core/src/java/org/apache/lucene org/apache/lucene lucene-
> 5.2.1/queries/src/java/org/apache/lucene/queries
> org/apache/lucene/queries
> lucene-5.2.1/sandbox/src/java/org/apache/lucene/sandbox
> org/apache/lucene/sandbox
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/autoprefix
> org/apache/lucene/codecs/autoprefix
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/blockterms
> org/apache/lucene/codecs/blockterms
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/blocktreeords
> org/apache/lucene/codecs/blocktreeords
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/bloom
> org/apache/lucene/codecs/bloom
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/memory
> org/apache/lucene/codecs/memory
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/autoprefix
> org/apache/lucene/codecs/autoprefix
> lucene-5.2.1/codecs/src/java/org/apache/lucene/codecs/simpletext
> org/apache/lucene/codecs/simpletext
> lucene-5.2.1/queryparser/src/java/org/apache/lucene/queryparser
> org/apache/lucene/queryparser
> lucene-5.2.1/analysis/common/src/java/org/apache/lucene/analysis/tr
> org/apache/lucene/analysis/tr
> lucene-5.2.1/analysis/common/src/java/org/apache/lucene/analysis/fr
> org/apache/lucene/analysis/fr
> lucene-5.2.1/analysis/common/src/java/org/apache/lucene/analysis/en
> org/apache/lucene/analysis/en
> lucene-5.2.1/analysis/common/src/java/org/apache/lucene/analysis/util
> org/apache/lucene/analysis/util
> lucene-5.2.1/analysis/common/src/java/org/apache/lucene/analysis/core
> org/apache/lucene/analysis/core
> lucene-
> 5.2.1/analysis/common/src/java/org/apache/lucene/analysis/standard
> org/apache/lucene/analysis/standard
> lucene-
> 5.2.1/analysis/common/src/java/org/apache/lucene/analysis/snowball
> org/apache/lucene/analysis/snowball
> lucene-
> 5.2.1/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous
> org/apache/lucene/analysis/miscellaneous
> 
> Apparently, the NamedSPILoader doesn't manage to find Codec with name
> 'Lucene50' even though org.apache.lucene.codecs.lucene50.Lucene50Codec
> is available.
> 
> Should I add any "corresponding JAR" to the classpath? If so, why should I if
> the project contains the org.apache.lucene.codecs.lucene50.Lucene50Codec
> src code? Did I do something wrong?
> 
> I would appreciate help on this issue.
> 
> Many Thanks!
> David.
> 
> 
> --
> David Yanay
> CTO
> 
> SmartMedia Marketing S.M.M.
> Derech HaYam 11, Haifa, 3463106, Israel
> http://www.smartmediamarketing.com
> 
> Mobile: +972-50-6856644
> Tel: +972-4-8583435
> Fax: +972-4-8583436
> LinkedIn: https://www.linkedin.com/in/yanay


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

Reply via email to