Sunday, April 1, 2018

FW: Error when indexing with SolrJ HTTP ERROR 405

-----Original Message-----
From: Shawn Heisey [mailto:elyograg@elyograg.org]
Sent: 20 March 2018 18:14
To: solr-user@lucene.apache.org
Subject: Re: Error when indexing with SolrJ HTTP ERROR 405

On 3/18/2018 9:46 PM, Khalid Moustapha Askia wrote:
> SolrClient client = new HttpSolrClient.Builder("
> http://localhost:8983/solr/#/corename").build();
>
> When I remove the "#" It throws a NullPointerException

URLs with # in them will ONLY work in a browser.  They will not work for
SolrJ.  Those URLs are for the admin UI, *not* for API access.

There are two ways to use HttpSolrClient properly.

One:
Create the client with "http://server:port/solr" and include the
core/collection name on each request.  SolrJ provides methods with a
collection name as one of the parameters.  One client object can be used to
access every core/collection available on that server.

Two:
Create the client with "http://server:port/solr/collection" where
"collection" is the name of the core or collection you want to use with that
client, and use the request methods without a collection name.

When you create/use the client without the # character, you say you get an
exception.  Can you share the full text of that exception?  It's likely to
be MANY lines long, and may have multiple "Caused by"
sections.  We will also need to know the versions of SolrJ and Solr that are
in use, so the line numbers in the exception can be used to find what went
wrong.

Thanks,
Shawn

No comments:

Post a Comment