You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Darren Hoffman <da...@prosoundcanada.com> on 2013/03/12 06:56:30 UTC

LUCENE-4713

I am having the same experience as issue LUCENE-4713.

Without modifying the source code myself, how do I overcome this? I am in
the middle of migrating from 3.6 to 4.2 and I am unable to index or search.

>From the source code, I see there is a setter for a codec but there's not a
constructor that accepts a codec. The exception is being thrown when I try
to instantiate IndexWriterConfig.

Thank you,
Darren Hoffman



RE: LUCENE-4713

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

I attached a patch to LUCENE-4713 that works around the context class loader issue, by also always scanning the classloader that loaded the lucene library (in fact the classloader that loaded the abstract base class of the SPI/codec). The context class loader is also scanned to collect any other additional SPIs that may be found.

Uwe

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


> -----Original Message-----
> From: Uwe Schindler [mailto:uwe@thetaphi.de]
> Sent: Tuesday, March 12, 2013 9:54 AM
> To: java-user@lucene.apache.org
> Subject: RE: LUCENE-4713
> 
> Use:
> Codecs.reloadCodecs(yourClassloader) in your application initialization code.
> yourClassloader can be e.g. this.getClass().getClassLoader().
> The same method exists for PostingsFormats, unfortunately there is no
> method to automatically reload all SPIs in Lucene.
> 
> The most correct fix would be to tell your application server to use the
> context class loader. The same issue exists with all SPIs Java might use (like
> XML parsers externally from the JDK are not found), so J2EE recommends to
> set the context class loader on application startup before you create any
> threads. Servlet containers like Tomcat or Jetty do this automatically.
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
> 
> 
> > -----Original Message-----
> > From: Darren Hoffman [mailto:darren@prosoundcanada.com]
> > Sent: Tuesday, March 12, 2013 6:57 AM
> > To: java-user@lucene.apache.org
> > Subject: LUCENE-4713
> >
> > I am having the same experience as issue LUCENE-4713.
> >
> > Without modifying the source code myself, how do I overcome this? I am
> > in the middle of migrating from 3.6 to 4.2 and I am unable to index or
> search.
> >
> > From the source code, I see there is a setter for a codec but there's
> > not a constructor that accepts a codec. The exception is being thrown
> > when I try to instantiate IndexWriterConfig.
> >
> > Thank you,
> > Darren Hoffman
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


RE: LUCENE-4713

Posted by Uwe Schindler <uw...@thetaphi.de>.
Use:
Codecs.reloadCodecs(yourClassloader) in your application initialization code. yourClassloader can be e.g. this.getClass().getClassLoader().
The same method exists for PostingsFormats, unfortunately there is no method to automatically reload all SPIs in Lucene.

The most correct fix would be to tell your application server to use the context class loader. The same issue exists with all SPIs Java might use (like XML parsers externally from the JDK are not found), so J2EE recommends to set the context class loader on application startup before you create any threads. Servlet containers like Tomcat or Jetty do this automatically.

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


> -----Original Message-----
> From: Darren Hoffman [mailto:darren@prosoundcanada.com]
> Sent: Tuesday, March 12, 2013 6:57 AM
> To: java-user@lucene.apache.org
> Subject: LUCENE-4713
> 
> I am having the same experience as issue LUCENE-4713.
> 
> Without modifying the source code myself, how do I overcome this? I am in
> the middle of migrating from 3.6 to 4.2 and I am unable to index or search.
> 
> From the source code, I see there is a setter for a codec but there's not a
> constructor that accepts a codec. The exception is being thrown when I try to
> instantiate IndexWriterConfig.
> 
> Thank you,
> Darren Hoffman
> 



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