Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 12F5810B7C for ; Sat, 13 Jul 2013 21:58:00 +0000 (UTC) Received: (qmail 51442 invoked by uid 500); 13 Jul 2013 21:57:58 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51397 invoked by uid 500); 13 Jul 2013 21:57:57 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 51389 invoked by uid 99); 13 Jul 2013 21:57:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jul 2013 21:57:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of uwe@thetaphi.de designates 188.138.97.18 as permitted sender) Received: from [188.138.97.18] (HELO mail.sd-datasolutions.de) (188.138.97.18) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jul 2013 21:57:51 +0000 Received: from VEGA (port-92-196-97-24.dynamic.qsc.de [92.196.97.24]) by mail.sd-datasolutions.de (Postfix) with ESMTPSA id C114C14AA07E for ; Sat, 13 Jul 2013 21:57:30 +0000 (UTC) From: "Uwe Schindler" To: References: In-Reply-To: Subject: RE: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist Date: Sat, 13 Jul 2013 23:57:31 +0200 Message-ID: <003001ce8013$f98dd940$eca98bc0$@thetaphi.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQI2TrCafsnc3yeD0Wy0eWQVhDK00AJdINEaAfEyU0gDOryccQHl/HBJAgrn6KCYN7atcA== Content-Language: de X-Virus-Checked: Checked by ClamAV on apache.org Hi Vignesh, Lucene 4 supports now so called "Codecs" which are implementation = classes for custom index encodings. E.g. you can exchange the default = postings list by a custom format. Those implementations are classes that = extend an abstract base class/interface to implement this functionality. = To plug this into the Lucene index format, IndexReader and IndexWriter = need the knowledge, which codec type was used to load the correct = classes. This is done by the Java Service Provider interface (SPI), = which is used quite often e.g. to load custom image formats, XML = parsers, Charsets,... in the JDK. The codec implementation classes are = listed in the JAR files META-INF section and then loaded by the code and = register themselves through the codec manager. There is no custom class = loading involved, it's all just plain Java. E.g. = Charset.forName("ISO-8859-1") in the JDK does exactly the same: It scans = META-INF for Charset files, loads all charsets and looks them up by = name. You can use this to e.g. plug in ICU4J to have more charsets than = in the default JDK. In your case there might be several reasons for this to fail: - Android only packs directly referenced classes into the DEX file = (similar to the Maven Shade plugin or the Jarjar tool). The codec = classes are not referenced my any internal Lucene class (only loaded via = SPI) so it might happen that the DEX tool was missing to pack them into = the resulting package. - You must append all META-INF files with the same name (if you merge = multiple Lucene JARS with different codecs). The Maven shade plugin can = do this for you. - Android's functionality behind ClassLoader#findResources() may be = broken (which is used to list the META-INF files, e.g. see = https://code.google.com/p/android/issues/detail?id=3D10076) - Be sure that the META-INF directory is in the root of your classes = folder (resp. DEX file). Apkbuilder by default does not add resources! I know form other developers that they definitely got Lucene 4 running = with Android, but the Lucene team can give no support, because it's an = unsupported configuration. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@thetaphi.de > -----Original Message----- > From: VIGNESH S [mailto:vigneshklncit@gmail.com] > Sent: Saturday, July 13, 2013 5:52 PM > To: java-user@lucene.apache.org > Subject: Re: A SPI class of type org.apache.lucene.codecs.Codec with = name > 'Lucene42' does not exist >=20 > Hi Robert, >=20 > Thanks for your reply. >=20 > If possible,can you please explain why this new class loading = mechanism was > introduced in Lucene 4 >=20 > Thanks and Regards > Vignesh >=20 >=20 > On Sat, Jul 13, 2013 at 6:56 PM, Robert Muir wrote: >=20 > > Open a bug with android team... the problem is android isn't java = (and > > doesnt implement/follow the spec) > > > > On Sat, Jul 13, 2013 at 4:31 AM, VIGNESH S > > wrote: > > > > > Hi, > > > > > > I did not striped META-INF/services and it contains the files. > > > > > > Even when i combined with other jars,i manually appended those > > > entries in Meta-inf/services.. > > > > > > The problem has some thing to do with the way android loads = classes. > > > > > > any comments welcome. > > > > > > > > > Thanks adnd Regards > > > Vignesh > > > > > > > > > On Sat, Jul 13, 2013 at 1:57 PM, Thomas Matthijs = > > wrote: > > > > > > > On Sat, Jul 13, 2013 at 10:25 AM, VIGNESH S > > > > > > > > wrote: > > > > > > > > > Hi, > > > > > > > > > > I tried indexing in Desktop..It works fine. > > > > > The above error loading error comes only in android.. > > > > > Any comments.. > > > > > > > > > > > > Don't strip META-INF/services files out of the jars > > > > > > > > > > > > > > > > -- > > > Thanks and Regards > > > Vignesh Srinivasan > > > 9739135640 > > > > > >=20 >=20 >=20 > -- > Thanks and Regards > Vignesh Srinivasan > 9739135640 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org