lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VIGNESH S <vigneshkln...@gmail.com>
Subject Re: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist
Date Sun, 14 Jul 2013 01:28:04 GMT
Hi Uwe,

Thanks for your detailed explanation.

It is like based on the Lucene Version(like 4.3.1 or 4.2.1),it loads the
 corresponding codec classes for the version.

I think instead of loading services from META-INF,/Services ,I can directly
return the needed codec for the Lucene Version in the lookup Method of
Codec Method

is my understanding correct?

Thanks and Regards
Vignesh

On Sun, Jul 14, 2013 at 3:27 AM, Uwe Schindler <uwe@thetaphi.de> wrote:

> 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: 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
> >
> > 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 <rcmuir@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 <vigneshklncit@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 <lists@selckin.be>
> > > wrote:
> > > >
> > > > > On Sat, Jul 13, 2013 at 10:25 AM, VIGNESH S
> > > > > <vigneshklncit@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Thanks and Regards
Vignesh Srinivasan
9739135640

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message