[ 
https://issues.apache.org/jira/browse/SOLR-17377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pierre Salagnac updated SOLR-17377:
-----------------------------------
    Description: 
Following SOLR-17096, we can declare a custom cluster singleton in {{solr.xml}} 
file.

There is an early check in class {{SolrXmlConfig}} to ensure the plugin 
actually implements interface {{{}ClusterSingleton{}}}. This check is broken 
for modules and fails for any class which is defined as an external plugin, and 
not in the Solr code itself because of a {{{}ClassNotFoundException{}}}.
My understanding is at this point, we don't have the _extended_ class loader 
that includes plugins yet.
{code:java}
org.apache.solr.common.SolrException:  Error loading class 'my.package.MyClass'
        at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:550)
        at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:471)
        at 
org.apache.solr.core.SolrXmlConfig.lambda$getClusterSingletonPluginInfos$10(Unknown
 Source)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at 
org.apache.solr.core.SolrXmlConfig.getClusterSingletonPluginInfos(SolrXmlConfig.java:714)
        at 
org.apache.solr.core.SolrXmlConfig.getClusterPlugins(SolrXmlConfig.java:668)
        ...........
Caused by: java.lang.ClassNotFoundException: my.package.MyClass
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
{code}
 

With the code of the check commented, the singleton is loaded with no error 
later. The issue is only with this early check itself, and not when 
instantiating and starting the singleton.

  was:
Following SOLR-17096, we can declare a custom cluster singleton in {{solr.xml}} 
file.

There is an early check in class {{SolrXmlConfig}} to ensure the plugin 
actually implements interface {{{}ClusterSingleton{}}}. This check is broken 
for modules and fails for any class which is defined as an external plugin, and 
not in the Solr code itself because of a {{{}ClassNotFoundException{}}}.
My understanding is at this point, we don't have the _extended_ class loader 
that includes plugins yet.
{code:java}
org.apache.solr.common.SolrException:  Error loading class 'my.package.MyClass'
        at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:550)
        at 
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:471)
        at 
org.apache.solr.core.SolrXmlConfig.lambda$getClusterSingletonPluginInfos$10(Unknown
 Source)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at 
org.apache.solr.core.SolrXmlConfig.getClusterSingletonPluginInfos(SolrXmlConfig.java:714)
        at 
org.apache.solr.core.SolrXmlConfig.getClusterPlugins(SolrXmlConfig.java:668)
        ...........
Caused by: java.lang.ClassNotFoundException: my.package.MyClass
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
{code}
 

With the code commented, the singleton is loaded with no error later. The issue 
is only with this early check itself, and not when instantiating and starting 
the singleton.


> ClusterSingleton defined in solr.xml cannot be loaded from a module
> -------------------------------------------------------------------
>
>                 Key: SOLR-17377
>                 URL: https://issues.apache.org/jira/browse/SOLR-17377
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: 9.5, 9.6
>            Reporter: Pierre Salagnac
>            Priority: Major
>
> Following SOLR-17096, we can declare a custom cluster singleton in 
> {{solr.xml}} file.
> There is an early check in class {{SolrXmlConfig}} to ensure the plugin 
> actually implements interface {{{}ClusterSingleton{}}}. This check is broken 
> for modules and fails for any class which is defined as an external plugin, 
> and not in the Solr code itself because of a {{{}ClassNotFoundException{}}}.
> My understanding is at this point, we don't have the _extended_ class loader 
> that includes plugins yet.
> {code:java}
> org.apache.solr.common.SolrException:  Error loading class 
> 'my.package.MyClass'
>       at 
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:550)
>       at 
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:471)
>       at 
> org.apache.solr.core.SolrXmlConfig.lambda$getClusterSingletonPluginInfos$10(Unknown
>  Source)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
>       at 
> org.apache.solr.core.SolrXmlConfig.getClusterSingletonPluginInfos(SolrXmlConfig.java:714)
>       at 
> org.apache.solr.core.SolrXmlConfig.getClusterPlugins(SolrXmlConfig.java:668)
>       ...........
> Caused by: java.lang.ClassNotFoundException: my.package.MyClass
>       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
>       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
> {code}
>  
> With the code of the check commented, the singleton is loaded with no error 
> later. The issue is only with this early check itself, and not when 
> instantiating and starting the singleton.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to