You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jens Ivar Jørdre <ji...@gmail.com> on 2014/12/23 21:25:30 UTC

Solr Cloud and relative paths in solrconfig.xml lib directives

Hi all,

I seek some advice on the use of lib directives in solrconfig.xml in Solr Cloud. My project has been tested with Solr 4.10.2 and run nicely on single node with the included Jetty. The setup adds a DataImportHandler request handler to solrconfig.xml. It also adds a lib directive to solconfig.xml to pick up dataimporhandler jars from «../../../dist».

Now, in migrating this setup to Solr Cloud I upconfig the configuration to ZooKeeper and create collection with the collections API’s CREATE action. The problem with this approach is that the relative path to dist in the lib directive does not resolve correctly.

failure: {
: "org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:Error CREATEing SolrCore 'cloudcollection1_shard2_replica2': Unable to create core [cloudcollection1_shard2_replica2] Caused by: org.apache.solr.handler.dataimport.DataImportHandler"
}

and the logs reveal that class org.apache.solr.handler.dataimport.DataImportHandler is yet to be found. Then, revamping my lib directive with absolute path to dist directory that includes the dataimporthandler jars, another upconfig and collection creation anew successfully creates the collection.

Is this intentional behavior forcing the use of absolute paths, or is it possible to use relative path to dist and contrib directories on solrconfig.xml in Cloud mode?

--
Sincerely,
Jens Ivar Jørdre
about.me/jijordre <http://about.me/jijordre>

Re: Solr Cloud and relative paths in solrconfig.xml lib directives

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
I think you may be running into a bug which was reported an hour back. See
https://issues.apache.org/jira/browse/SOLR-6887

On Tue, Dec 23, 2014 at 8:25 PM, Jens Ivar Jørdre <ji...@gmail.com>
wrote:

> Hi all,
>
> I seek some advice on the use of lib directives in solrconfig.xml in Solr
> Cloud. My project has been tested with Solr 4.10.2 and run nicely on single
> node with the included Jetty. The setup adds a DataImportHandler request
> handler to solrconfig.xml. It also adds a lib directive to solconfig.xml to
> pick up dataimporhandler jars from «../../../dist».
>
> Now, in migrating this setup to Solr Cloud I upconfig the configuration to
> ZooKeeper and create collection with the collections API’s CREATE action.
> The problem with this approach is that the relative path to dist in the lib
> directive does not resolve correctly.
>
> failure: {
> :
> "org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:Error
> CREATEing SolrCore 'cloudcollection1_shard2_replica2': Unable to create
> core [cloudcollection1_shard2_replica2] Caused by:
> org.apache.solr.handler.dataimport.DataImportHandler"
> }
>
> and the logs reveal that class
> org.apache.solr.handler.dataimport.DataImportHandler is yet to be found.
> Then, revamping my lib directive with absolute path to dist directory that
> includes the dataimporthandler jars, another upconfig and collection
> creation anew successfully creates the collection.
>
> Is this intentional behavior forcing the use of absolute paths, or is it
> possible to use relative path to dist and contrib directories on
> solrconfig.xml in Cloud mode?
>
> --
> Sincerely,
> Jens Ivar Jørdre
> about.me/jijordre <http://about.me/jijordre>
>



-- 
Regards,
Shalin Shekhar Mangar.

Re: Solr Cloud and relative paths in solrconfig.xml lib directives

Posted by Erick Erickson <er...@gmail.com>.
You ought to be able to specify an environment var
as well. S you have something like this in your
solrocnfig.xml file:
 <lib dir="${solr.install.dir:../../..}/contrib/clustering/lib/"
regex=".*\.jar" />

and define solr.install.dir as a system var when you
invoke Solr.

Best,
Erick

On Tue, Dec 23, 2014 at 2:05 PM, Shawn Heisey <ap...@elyograg.org> wrote:
> On 12/23/2014 1:25 PM, Jens Ivar Jørdre wrote:
>> I seek some advice on the use of lib directives in solrconfig.xml in Solr Cloud. My project has been tested with Solr 4.10.2 and run nicely on single node with the included Jetty. The setup adds a DataImportHandler request handler to solrconfig.xml. It also adds a lib directive to solconfig.xml to pick up dataimporhandler jars from «../../../dist».
>
> Dominique's answer is the best approach ... but you should remove *all*
> <lib> directives from solrconfig.xml.  You don't even need the directive
> that he mentioned with "../lib".
>
> Just create a "lib" directory in the same place as your solr.xml and put
> all the extra jars needed by all your collections in that directory.
> Make sure that all other copies of those jars are not on your classpath.
>
> As of Solr 4.3 (from what I remember, that's the right version),
> ${solr.solr.home}/lib is automatically included by the resource loader.
> Prior to that version, you had to include sharedLib=lib in solr.xml.  I
> ran into a problem related to this, a problem that was declared to NOT
> be a bug:
>
> https://issues.apache.org/jira/browse/SOLR-4852?focusedCommentId=13820197&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13820197
>
> Thanks,
> Shawn
>

Re: Solr Cloud and relative paths in solrconfig.xml lib directives

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/23/2014 1:25 PM, Jens Ivar Jørdre wrote:
> I seek some advice on the use of lib directives in solrconfig.xml in Solr Cloud. My project has been tested with Solr 4.10.2 and run nicely on single node with the included Jetty. The setup adds a DataImportHandler request handler to solrconfig.xml. It also adds a lib directive to solconfig.xml to pick up dataimporhandler jars from «../../../dist».

Dominique's answer is the best approach ... but you should remove *all*
<lib> directives from solrconfig.xml.  You don't even need the directive
that he mentioned with "../lib".

Just create a "lib" directory in the same place as your solr.xml and put
all the extra jars needed by all your collections in that directory. 
Make sure that all other copies of those jars are not on your classpath.

As of Solr 4.3 (from what I remember, that's the right version),
${solr.solr.home}/lib is automatically included by the resource loader. 
Prior to that version, you had to include sharedLib=lib in solr.xml.  I
ran into a problem related to this, a problem that was declared to NOT
be a bug:

https://issues.apache.org/jira/browse/SOLR-4852?focusedCommentId=13820197&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13820197

Thanks,
Shawn


Re: Solr Cloud and relative paths in solrconfig.xml lib directives

Posted by Dominique Bejean <do...@eolya.fr>.
Hi,

I use to put all dependency jar files (dih, adbc driver, …) in a lib
directory in the solr home directory where your shard are created.

something like this

solr/
    solr.xml
    cloudcollection1_shard2_replica2/
    lib/


In solrconfig.xml, I remove all the <lib …> directives except this one <lib
 dir="../lib" />
You may need to restart your nodes after creating your lib directory

Regards

Dominique

2014-12-23 21:25 GMT+01:00 Jens Ivar Jørdre <ji...@gmail.com>:

> Hi all,
>
> I seek some advice on the use of lib directives in solrconfig.xml in Solr
> Cloud. My project has been tested with Solr 4.10.2 and run nicely on single
> node with the included Jetty. The setup adds a DataImportHandler request
> handler to solrconfig.xml. It also adds a lib directive to solconfig.xml to
> pick up dataimporhandler jars from «../../../dist».
>
> Now, in migrating this setup to Solr Cloud I upconfig the configuration to
> ZooKeeper and create collection with the collections API’s CREATE action.
> The problem with this approach is that the relative path to dist in the lib
> directive does not resolve correctly.
>
> failure: {
> :
> "org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:Error
> CREATEing SolrCore 'cloudcollection1_shard2_replica2': Unable to create
> core [cloudcollection1_shard2_replica2] Caused by:
> org.apache.solr.handler.dataimport.DataImportHandler"
> }
>
> and the logs reveal that class
> org.apache.solr.handler.dataimport.DataImportHandler is yet to be found.
> Then, revamping my lib directive with absolute path to dist directory that
> includes the dataimporthandler jars, another upconfig and collection
> creation anew successfully creates the collection.
>
> Is this intentional behavior forcing the use of absolute paths, or is it
> possible to use relative path to dist and contrib directories on
> solrconfig.xml in Cloud mode?
>
> --
> Sincerely,
> Jens Ivar Jørdre
> about.me/jijordre <http://about.me/jijordre>
>