On 1/14/2016 5:36 AM, Callum Lamb wrote:
> I've got an extension jar that contains a class which extends from
>
> org.apache.solr.handler.dataimport.DataSource
>
> But it only works if it's within the solr/dist folder. However when stored
> in the lib/ folder within Solr home. When it tries to load the class it
> cannot find it's parent:
>
> Exception in thread "Thread-69" java.lang.NoClassDefFoundError:
> org/apache/solr/handler/dataimport/DataSource
>         at
> org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:374)
>         at
> org.apache.solr.handler.dataimport.ContextImpl.getDataSource(ContextImpl.java:102)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.solr.handler.dataimport.DataSource
>
> The classes in the lib folder don't have access to the class within the
> dist folder in their classpath when they are loaded.
>
> I'd like the keep my solr install separate from my configs/plugins/indexes
> so I want to avoid putting it into the dist folder unless I absolutely have
> to.

If you're going to put jars in $SOLR_HOME/lib, then you should *only*
put jars in that directory, and NOT load jars explicitly.  The <lib>
directives should not be used in solrconfig.xml when jars are loaded
from this directory, because Solr will automatically load jars from this
location and make them available to all cores.

If moving all your extra jars (including things like the dataimport jar)
to $SOLR_HOME/lib and taking out jar loading in solrconfig.xml doesn't
help, then depending on the Solr version, you *might* be running into
SOLR-6188.

https://issues.apache.org/jira/browse/SOLR-6188

You'll want to be sure that you don't the same jar more than once.  This
is the root of the specific problem that SOLR-6188 solves.  Loading the
same jar more than once can also happen if the jar is in the lib
directory AND mentioned on a <lib> config element.

Thanks,
Shawn

Reply via email to