Summary
This article discusses how to deploy a custom Solr query parser plugin for DataStax Enterprise Search.
The procedure below can also be used for deploying other custom Solr libraries with the appropriate Solr/Lucene directive configured in solrconfig.xml
.
Symptoms
Attempts to deploy custom Solr libraries in DSE fails resulting in a java.lang.ClassNotFoundException
. Below is a sample error stack trace reported in system.log
:
ERROR [http-8983-exec-5] 2014-12-16 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) ...
Cause
The issue is due to the plugin JAR not being placed in the correct lib/
directory. The location for library files in DataStax Enterprise is not the same as open-source Solr.
Solution
Using the class in the example above and assuming that the JAR filename is com.boogle.search.CustomQParserPlugin-1.0.jar
, follow these steps in order to get the custom plugin working on all DSE Search nodes.
Step 1 - Define the parser in solrconfig.xml
with:
<queryParser name="myCustomQP" class="com.boogle.search.CustomQParserPlugin"/>
Step 2 - Deploy the JAR on all Search nodes in the cluster in the appropriate lib/
directory as documented in Configuring the Solr library path. For example, the JAR is placed in the following location for packaged DSE installations:
/usr/share/dse/solr/lib/com.boogle.search.CustomQParserPlugin-1.0.jar
Step 3 - Reload the Solr core with the new configuration.
See also
DataStax doc 4.8 - Configuring the Solr library path