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 jfeist <jf...@llminc.com> on 2014/02/11 01:05:22 UTC

java.lang.IllegalArgumentException when using SolrJ CloudSolrServer

I'm using Solr 4.5.1 and trying to use the SolrCloud setup.  I have Zookeeper
and Solr running on three machines.  I have some Java code that does the
following.

SolrServer ss = new
CloudSolrServer("http://localhost:8983/solr/collection1"); 
ss.deleteByQuery("*:*");

That gives me the following stack trace.


Exception in thread "main" java.lang.RuntimeException:
java.lang.IllegalArgumentException: Invalid path string
"//localhost:8983/solr/collection1" caused by empty node name specified @1
        at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:123)
        at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:88)
        at
org.apache.solr.common.cloud.ZkStateReader.<init>(ZkStateReader.java:148)
        at
org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:227)
        at
org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:488)
        at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
        at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:285)
        at
org.apache.solr.client.solrj.SolrServer.deleteByQuery(SolrServer.java:271)
        at
com.demoapp.search.index.server.SolrSearchServer.deleteByQuery(SolrSearchServer.java:202)

I can post to the url (using java
-Durl=http://localhost:8983/solr/collection1/update -jar post.jar
ipod_video.xml) successfully, but anything using SolrJ gives that stack
trace.  If I change from a CloudSolrServer to an HttpSolrServer, I don't
have any problems either.  Can anyone help with this issue?




--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-IllegalArgumentException-when-using-SolrJ-CloudSolrServer-tp4116585.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: java.lang.IllegalArgumentException when using SolrJ CloudSolrServer

Posted by jfeist <jf...@llminc.com>.
That did fix my issue, thanks so much.



--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-IllegalArgumentException-when-using-SolrJ-CloudSolrServer-tp4116585p4117279.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: java.lang.IllegalArgumentException when using SolrJ CloudSolrServer

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/10/2014 5:05 PM, jfeist wrote:
> I'm using Solr 4.5.1 and trying to use the SolrCloud setup.  I have Zookeeper
> and Solr running on three machines.  I have some Java code that does the
> following.
>
> SolrServer ss = new
> CloudSolrServer("http://localhost:8983/solr/collection1");
> ss.deleteByQuery("*:*");
>
> That gives me the following stack trace.
>
>
> Exception in thread "main" java.lang.RuntimeException:
> java.lang.IllegalArgumentException: Invalid path string
> "//localhost:8983/solr/collection1" caused by empty node name specified @1

CloudSolrServer does not use a URL for initilization.  It uses a 
zookeeper connection string -- the same thing that you use for the 
zkHost parameter when starting SolrCloud.  A proper value would be 
something like this:

"zk1.example.com:2181,zk2.example.com:2181,zk3.example.com:2181/mysolr"

Thanks,
Shawn