Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-17377

ClusterSingleton defined in solr.xml cannot be loaded from a module

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 9.5, 9.6
    • None
    • None
    • None

    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.

      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)
      

       

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pierre.salagnac Pierre Salagnac
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: