Configuring the Solr library path

Workaround for DSE Search failure to find files in directories that are defined by the <lib> property.

The location for library files in DataStax Enterprise is not the same location as open source Apache Solr™. Contrary to the examples shown in the solrconfig.xml file that indicate support for relative paths, DSE Search does not support the relative path values that are set for the <lib> property and cannot find files in directories that are defined by the <lib> property. The workaround is to place custom code or Solr contrib modules in the Solr library directories.

The default Solr library path location depends on the type of installation:
  • Package installations and Installer-Services: /usr/share/dse/solr/lib
  • Tarball installations and Installer-No Services: installation_location/resources/solr/lib
When the plugin JAR file is not in the directory that is defined by the <lib> property, attempts to deploy custom Solr libraries in DataStax Enterprise fail with java.lang.ClassNotFoundException and an error in the system.log like this:
ERROR [http-8983-exec-5] 2015-12-06 16:32:33,992 CoreContainer.java (line 956) Unable to create core: boogle.main 
org.apache.solr.common.SolrException: Error loading class 'com.boogle.search.CustomQParserPlugin' 
at org.apache.solr.core.SolrCore.(SolrCore.java:851) 
at org.apache.solr.core.SolrCore.(SolrCore.java:640) 
at com.datastax.bdp.search.solr.core.CassandraCoreContainer.doCreate(CassandraCoreContainer.java:675) 
at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:234) 
at com.datastax.bdp.search.solr.core.SolrCoreResourceManager.createCore(SolrCoreResourceManager.java:256) 
at com.datastax.bdp.search.solr.handler.admin.CassandraCoreAdminHandler.handleCreateAction(CassandraCoreAdminHandler.java:117)
...
Caused by: org.apache.solr.common.SolrException: Error loading class 'com.boogle.search.CustomQParserPlugin' 
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:474) 
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:405) 
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:541) 
...
Caused by: java.lang.ClassNotFoundException: com.boogle.search.CustomQParserPlugin 
at java.net.URLClassLoader$1.run(Unknown Source) 
at java.net.URLClassLoader$1.run(Unknown Source) 
...

Workaround

Using the class in this example with the JAR file name com.boogle.search.CustomQParserPlugin-1.0.jar, follow these steps to get the custom plugin working on all DSE Search nodes.
  1. Define the parser in the search index config file:
    <queryParser name="myCustomQP" class="com.boogle.search.CustomQParserPlugin"/>
  2. Place custom code or Solr contrib modules in the Solr library directories.
  3. Deploy the JAR file on all DSE Search nodes in the cluster in the appropriate lib/ directory.

    For example, package installations: /usr/share/dse/solr/lib/com.boogle.search.CustomQParserPlugin-1.0.jar

  4. Reload the search index with the new configuration.