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

Uwe Schindler commented on SOLR-6188:
-------------------------------------

Hi the reason for this issue is indeed caused by SOLR-4852: The reason why it 
works with absolute classname is the following:
- If you use the absolute class name, the class is loaded by Class.forName from 
SolrResourceLoader
- If you use the shortcut, the Solr 3.x backwards layer for finding factory 
classes is used. The solr.XXXFactory name is rewritten to a call to 
TokenFilterFactory.forName(). This forName call uses the classpath it was 
initialized with. TokenFilterFactory is a static class and doe snot really know 
classloaders (because there is only one single instance). Every 
SolrResourceLoader calls an update process, that scans the own classpath and 
adds all *new* factory instances to the forName() lookup map.

What happens here: In an earlier stage, it looks like SolrResourceLoader has 
seen a Factory instance loaded by SPI and cached its factory class for 
forName(). But later the classpath and classloader was replaced and the scanner 
was called again. This onescanned classpath again, and found a new instance of 
the FactoryClass (the new one that should be used). Because this one was 
already in the forName cache, it did not replace that one. In the meantime, the 
old classloader was closed with Java 7's URLClassLoacer.close() method. Because 
of this a call to forName returned the factory class, but the dependend classes 
it was referring to are no longer loadable (classloader closed). This causes 
the bug.

The fix is not easily possible, I will think about it.

> solr.ICUFoldingFilterFactory causes NoClassDefFoundError: 
> o/a/l/a/icu/ICUFoldingFilter
> --------------------------------------------------------------------------------------
>
>                 Key: SOLR-6188
>                 URL: https://issues.apache.org/jira/browse/SOLR-6188
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>    Affects Versions: 4.8.1
>            Reporter: Ahmet Arslan
>              Labels: ICUFoldingFilterFactory
>             Fix For: 4.10
>
>
> When fully qualified class name is used in schema.xml 
> {{org.apache.lucene.analysis.icu.ICUFoldingFilterFactory}}
> it works. However as documented in confluence and wiki, when 
> {{solr.ICUFoldingFilterFactory}} is used it throws following exception.
> This is true for both released 4.8.1 version and trunk r1604168
> following type works :
> {code:xml}    
>      <fieldType name="folded2" class="solr.TextField">
>       <analyzer>
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter 
> class="org.apache.lucene.analysis.icu.ICUFoldingFilterFactory"/>
>       </analyzer>
>     </fieldType>
> {code}
> this does not : 
> {code:xml}
>  <fieldType name="folded" class="solr.TextField">
>       <analyzer>
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.ICUFoldingFilterFactory"/>
>       </analyzer>
>     </fieldType>
> {code}
> {noformat}
> 257 [main] ERROR org.apache.solr.core.SolrCore  – Error loading 
> core:java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: 
> org/apache/lucene/analysis/icu/ICUFoldingFilter
>       at java.util.concurrent.FutureTask.report(FutureTask.java:122)
>       at java.util.concurrent.FutureTask.get(FutureTask.java:188)
>       at org.apache.solr.core.CoreContainer.load(CoreContainer.java:301)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.createCoreContainer(SolrDispatchFilter.java:190)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:137)
>       at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:719)
>       at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
>       at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1252)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)
>       at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:39)
>       at 
> org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)
>       at 
> org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:494)
>       at 
> org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:141)
>       at 
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:145)
>       at 
> org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:56)
>       at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:609)
>       at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:540)
>       at org.eclipse.jetty.util.Scanner.scan(Scanner.java:403)
>       at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:337)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:121)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:555)
>       at 
> org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:230)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:81)
>       at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:96)
>       at org.eclipse.jetty.server.Server.doStart(Server.java:280)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
>       at 
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1259)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1182)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at org.eclipse.jetty.start.Main.invokeMain(Main.java:473)
>       at org.eclipse.jetty.start.Main.start(Main.java:615)
>       at org.eclipse.jetty.start.Main.main(Main.java:96)
> Caused by: java.lang.NoClassDefFoundError: 
> org/apache/lucene/analysis/icu/ICUFoldingFilter
>       at java.lang.Class.getDeclaredConstructors0(Native Method)
>       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
>       at java.lang.Class.getConstructor0(Class.java:2803)
>       at java.lang.Class.getConstructor(Class.java:1718)
>       at 
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:602)
>       at 
> org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:382)
>       at 
> org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:376)
>       at 
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
>       at 
> org.apache.solr.schema.FieldTypePluginLoader.readAnalyzer(FieldTypePluginLoader.java:400)
>       at 
> org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:95)
>       at 
> org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:43)
>       at 
> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
>       at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:492)
>       at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:172)
>       at 
> org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
>       at 
> org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
>       at 
> org.apache.solr.core.ConfigSetService.createIndexSchema(ConfigSetService.java:89)
>       at 
> org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:62)
>       at org.apache.solr.core.CoreContainer.create(CoreContainer.java:554)
>       at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:261)
>       at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:253)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassNotFoundException: 
> org.apache.lucene.analysis.icu.ICUFoldingFilter
>       at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>       at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
>       at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
>       ... 27 more
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to