[
https://issues.apache.org/jira/browse/LUCENE-6774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727594#comment-14727594
]
Uwe Schindler edited comment on LUCENE-6774 at 9/2/15 4:59 PM:
---------------------------------------------------------------
Hi,
I checked the code after a beer and now I know what the issue is. In fact the
ResourceUtils code did not change since Solr 4.0 where SOLR-4007 was reported
on. This was using version 1.5.5 of Morphologik.
The problem is very simple:
# Morphologic tries context class loader first, obviously this fails for Solr
(SOLR-3716)
# As a second try it does "the right thing" but obviously wrong: It uses
ResourceUtil.class.getResourceAsStream(), and this fails because when loading
the resource it uses an absolute path inclusive package, but without a slash.
This of course fails, because the file is not found. This causes Solr fail.
# Finally it tries the system classloader. Of course the resource isn't there,
because the system classloader has no morphologic jars
The issue here is the stupid java difference: If you use a Classloader, you
don't need leading slash. If you use Class#getResource() it resolves against
current package, so you need a leading slash, if you want it with an absolute
path.
In single classloader applications this is no issue, because the context
classloader always works, but not in Solr.
was (Author: thetaphi):
Hi,
I checked the code after a beer and now I know what the issue is. In fact the
ResourceUtils code did not change since Solr 4.0 where SOLR-4007 was reported
on. This was using version 1.5.5 of Morphologik.
The problem is very simple:
# Morphologic tries context class loader first, obviously this fails for Solr
(SOLR-3716)
# As a second try it does "the right thing" but obviously wrong: It uses
ResourceUtil.class.getResourceAsStream(), and this fails because when loading
the resource it uses an absolute path inclusive package, but without a slash.
This of course fails, because the file is not found. This causes Solr fail.
# Finally it tries the system classloader. Of course the resource isn't there,
because the system classloader has
The issue here is the stupid java difference: If you use a Classloader, you
don't need leading slash. If you use Class#getResource() it resolves against
current package, so you need a leading slash, if you want it with an absolute
path.
In single classloader applications this is no issue, because the context
classloader always works, but not in Solr.
> Remove solr hack in MorfologikFilter
> ------------------------------------
>
> Key: LUCENE-6774
> URL: https://issues.apache.org/jira/browse/LUCENE-6774
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Priority: Blocker
> Fix For: 5.3.1
>
> Attachments: LUCENE-6774.patch
>
>
> If solr wants to set the contextClassLoader because its classloading is
> fucked up, then it needs to do this hack itself: it should not be in lucene
> code.
> The current mess prevents use of this analyzer in other environments
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]