Search code examples
javasolr

Does each Solr core have its own classloader?


When creating plugins for Solr, you add some plugin library jar files into the solrconfig.xml file:

<lib dir="/path/to/jar/files" regex=".*\.jar" />

In my case, I use a few system libraries (.dll, .so)

And I need to make sure they do not try to load them more than once.

Does each Solr core have its own classloader?


Solution

  • I was talking with some Solr committers via slack and they said the answer is Yes. Each core has its own classloader. See https://issues.apache.org/jira/browse/SOLR-16131 for a read on some issues related to this, which confirms that each core has its own classloader.

    Update: Solr 9.x from comments

    I had to add my custom plugin (now module in 9.x) to the solr.modules variable, otherwise it still instantiates multiple singletons.