[ 
https://issues.apache.org/jira/browse/LUCENE-5956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14614613#comment-14614613
 ] 

Uwe Schindler commented on LUCENE-5956:
---------------------------------------

bq. What I'm trying to do, which should work, and appears to be working, is to 
rename all org.apache.lucene for a given version to some.other.place.luceneN. 
At the moment, at least classname lookups appear to be working. (Other weird 
things are going on, but I don't have the foggiest idea what's going on there 
yet.)

You have to load them in different classloaders, see my reply on user mailing 
list:

{quote}
Hi,

It could be the reason for this is your classpath:

If you load all Lucene Versions into the same classloader (but with different 
package names - I assume you use Maven Shade plugin to do this), Lucene 3 will 
load perfectly, yes; Lucene 4 will also load perfectly, yes! But when it tries 
to load Lucene 5, it will fail to load all shipped codecs. Codecs are not 
identified by their Java package name, but by the symbolic name (like 
"Lucene50") as written into the index. The SPI interface of Lucene will load 
all codecs from classpath and save them in a lookup map based on the symbolic 
name. If the Lucene 4 JAR file are placed before Lucene 5 JARs, the "slots" for 
codec names are already taken (because the Lucene 5 loader will see the Lucene 
4 codecs first), so loading Lucene 5 variants of old codecs is a no-op. This 
may cause those problems, because Lucene 5 ships with "modified" versions of 
the old Lucene 4 codecs - but they are not identical.

You can only workaround by loading the Lucene JARs into completely different 
classloaders (don't forget to also set context classloader!). In that case you 
would not even need to change package names!
{quote}

> Add runnable index upgrader
> ---------------------------
>
>                 Key: LUCENE-5956
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5956
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Ryan Ernst
>
> As a spinoff from discussion in LUCENE-5940, I'd like to add a new module 
> "lucene-upgrader", move {{IndexUpgrader}} to this, and add embed older 
> versions of lucene (just enough to upgrade indexes) in the built version of 
> the module's jar.  This would be runnable from the command line with 
> something like:
> {{java -jar lucene-upgrader-4.11.0.jar /path/to/index}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to