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=10076) - 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: u...@thetaphi.de > -----Original Message----- > From: VIGNESH S [mailto:vigneshkln...@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 > > Hi Robert, > > Thanks for your reply. > > If possible,can you please explain why this new class loading mechanism was > introduced in Lucene 4 > > Thanks and Regards > Vignesh > > > On Sat, Jul 13, 2013 at 6:56 PM, Robert Muir <rcm...@gmail.com> wrote: > > > 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 <vigneshkln...@gmail.com> > > 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 <li...@selckin.be> > > wrote: > > > > > > > On Sat, Jul 13, 2013 at 10:25 AM, VIGNESH S > > > > <vigneshkln...@gmail.com> > > > > 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 > > > > > > > > > -- > Thanks and Regards > Vignesh Srinivasan > 9739135640 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org