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
Re: Error when indexing with SolrJ HTTP ERROR 405
Regarding the # in the Solr Url, I found that I also have the # that appears automatically in the Solr URL when I'm at the Solr Admin UI. Even when I correct it to remove it, it will appear again. How can we remove the #? Regards, Edwin On 19 March 2018 at 17:36, Vincenzo D'Amore wrote: > Pay attention to # in the Solr Url http://localhost:8983/solr/#/corename > > Try to correct it into http://localhost:8983/solr/corename > > > On Mon, Mar 19, 2018 at 8:47 AM, Shamik Sinha > wrote: > > > You need to send binary content instead of html. Atleast that is what the > > error shows. > > > > I also think the url is wrong. The correct url should have > > http://localhost:8983/solr/core/update > > > > > > Check first whether indexing is working on the same data that you are > > trying to or not using the browser based tools. Check the url for the > same. > > Then based on your requirement decide whether to use dih or oob indexing > > Thanks and regards, > > Shamik > > > > On Mon 19 Mar, 2018, 1:02 PM Khalid Moustapha Askia, < > > m.askiakha...@gmail.com> wrote: > > > > > Hi. I am trying to index some data with Solr by using SolrJ. But I have > > > this error that I can't solve. > > > > > > > > > > > - > > > Exception in thread "main" > > > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: > > Error > > > from server at http://localhost:8983/solr/#/corename: Expected mime > type > > > application/octet-stream but got text/html. > > > > > > > > > Error 405 HTTP POST method is not supported by this > > URL > > > > > > HTTP ERROR 405 > > > Problem accessing /solr/index.html. Reason: > > > Error 405 HTTP POST method is not supported by this > > > URL > > > > > > > > > > > > at > > > > > > org.apache.solr.client.solrj.impl.HttpSolrClient. > > executeMethod(HttpSolrClient.java:558) > > > at > > > > > > org.apache.solr.client.solrj.impl.HttpSolrClient.request( > > HttpSolrClient.java:259) > > > at > > > > > > org.apache.solr.client.solrj.impl.HttpSolrClient.request( > > HttpSolrClient.java:248) > > > at > > > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) > > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > > java:106) > > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > > java:71) > > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > > java:85) > > > at indexsolr.index(indexsolr.java:33) > > > at LoadData.toIndex(LoadData.java:102) > > > at LoadData.loadDocuments(LoadData.java:72) > > > at IndexLaunch.main(IndexLaunch.java:12) > > > > > > > > > > > -- > > > > > > This is how I connect (I am in local): > > > > > > > > > > > > SolrClient client = new HttpSolrClient.Builder(" > > > http://localhost:8983/solr/#/corename";).build(); > > > > > > When I remove the "#" It throws a NullPointerException > > > > > > I have been struggling for a week with this indexing... > > > > > > > > > -- > Vincenzo D'Amore >
Re: Error when indexing with SolrJ HTTP ERROR 405
Pay attention to # in the Solr Url http://localhost:8983/solr/#/corename Try to correct it into http://localhost:8983/solr/corename On Mon, Mar 19, 2018 at 8:47 AM, Shamik Sinha wrote: > You need to send binary content instead of html. Atleast that is what the > error shows. > > I also think the url is wrong. The correct url should have > http://localhost:8983/solr/core/update > > > Check first whether indexing is working on the same data that you are > trying to or not using the browser based tools. Check the url for the same. > Then based on your requirement decide whether to use dih or oob indexing > Thanks and regards, > Shamik > > On Mon 19 Mar, 2018, 1:02 PM Khalid Moustapha Askia, < > m.askiakha...@gmail.com> wrote: > > > Hi. I am trying to index some data with Solr by using SolrJ. But I have > > this error that I can't solve. > > > > > > > - > > Exception in thread "main" > > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: > Error > > from server at http://localhost:8983/solr/#/corename: Expected mime type > > application/octet-stream but got text/html. > > > > > > Error 405 HTTP POST method is not supported by this > URL > > > > HTTP ERROR 405 > > Problem accessing /solr/index.html. Reason: > > Error 405 HTTP POST method is not supported by this > > URL > > > > > > > > at > > > > org.apache.solr.client.solrj.impl.HttpSolrClient. > executeMethod(HttpSolrClient.java:558) > > at > > > > org.apache.solr.client.solrj.impl.HttpSolrClient.request( > HttpSolrClient.java:259) > > at > > > > org.apache.solr.client.solrj.impl.HttpSolrClient.request( > HttpSolrClient.java:248) > > at > > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > java:106) > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > java:71) > > at org.apache.solr.client.solrj.SolrClient.add(SolrClient. > java:85) > > at indexsolr.index(indexsolr.java:33) > > at LoadData.toIndex(LoadData.java:102) > > at LoadData.loadDocuments(LoadData.java:72) > > at IndexLaunch.main(IndexLaunch.java:12) > > > > > > > -- > > > > This is how I connect (I am in local): > > > > > > > > SolrClient client = new HttpSolrClient.Builder(" > > http://localhost:8983/solr/#/corename";).build(); > > > > When I remove the "#" It throws a NullPointerException > > > > I have been struggling for a week with this indexing... > > > -- Vincenzo D'Amore
Re: Error when indexing with SolrJ HTTP ERROR 405
You need to send binary content instead of html. Atleast that is what the error shows. I also think the url is wrong. The correct url should have http://localhost:8983/solr/core/update Check first whether indexing is working on the same data that you are trying to or not using the browser based tools. Check the url for the same. Then based on your requirement decide whether to use dih or oob indexing Thanks and regards, Shamik On Mon 19 Mar, 2018, 1:02 PM Khalid Moustapha Askia, < m.askiakha...@gmail.com> wrote: > Hi. I am trying to index some data with Solr by using SolrJ. But I have > this error that I can't solve. > > > - > Exception in thread "main" > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error > from server at http://localhost:8983/solr/#/corename: Expected mime type > application/octet-stream but got text/html. > > > Error 405 HTTP POST method is not supported by this URL > > HTTP ERROR 405 > Problem accessing /solr/index.html. Reason: > Error 405 HTTP POST method is not supported by this > URL > > > > at > > org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:558) > at > > org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:259) > at > > org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248) > at > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) > at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106) > at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71) > at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:85) > at indexsolr.index(indexsolr.java:33) > at LoadData.toIndex(LoadData.java:102) > at LoadData.loadDocuments(LoadData.java:72) > at IndexLaunch.main(IndexLaunch.java:12) > > > -- > > This is how I connect (I am in local): > > > > SolrClient client = new HttpSolrClient.Builder(" > http://localhost:8983/solr/#/corename";).build(); > > When I remove the "#" It throws a NullPointerException > > I have been struggling for a week with this indexing... >
Error when indexing with SolrJ HTTP ERROR 405
Hi. I am trying to index some data with Solr by using SolrJ. But I have this error that I can't solve. - Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/#/corename: Expected mime type application/octet-stream but got text/html. Error 405 HTTP POST method is not supported by this URL HTTP ERROR 405 Problem accessing /solr/index.html. Reason: Error 405 HTTP POST method is not supported by this URL at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:558) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:259) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248) at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:85) at indexsolr.index(indexsolr.java:33) at LoadData.toIndex(LoadData.java:102) at LoadData.loadDocuments(LoadData.java:72) at IndexLaunch.main(IndexLaunch.java:12) -- This is how I connect (I am in local): SolrClient client = new HttpSolrClient.Builder(" http://localhost:8983/solr/#/corename";).build(); When I remove the "#" It throws a NullPointerException I have been struggling for a week with this indexing...