10

I am new to using solr. I currently have solr running on http://localhost::8983/solr. My goal is to index numerous files. I have verified that the core I'm trying to post to exists by listing all cores in solr,I used the method explained here

I also understand that to post to a specific core using SimplePostTool, one must use java -Durl=http://localhost:8983/solr/<corename>/update -jar post.jar <filename>

The issue, however, is that I get the following error.

SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/collection1/update using content-type application/xml..
POSTing file tmpzWztTN
SimplePostTool: WARNING: Solr returned an error #404 Not Found
SimplePostTool: WARNING: IOException while reading response: java.io.FileNotFoundException: http://localhost:8983/solr/collection1/update
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/collection1/update..
SimplePostTool: WARNING: Solr returned an error #404 Not Found for url http://localhost:8983/solr/collection1/update?commit=true
Time spent: 0:00:00.023

Since I have verified that the core, collection1, exists, why does it say the url cannot be found? What am i missing? How does one fix this?

Community
  • 1
  • 1
Adeeb
  • 1,271
  • 3
  • 16
  • 33

6 Answers6

15

It looks like gettingstarted core is not being created. Create 'gettingstarted' core with this command.

bin/solr create -c gettingstarted

Once the core is created bin/post -c gettingstarted docs/ command runs without any error.

Community
  • 1
  • 1
Ramesh Pabbati
  • 151
  • 1
  • 3
4

As in @cheffe's comment, it turns out I was missing <requestHandler> name="/update" ...

I am a solr noob so I looked up requestHandlers's here. This tutorial was also helpful. In essense, I only added the following line in my solrconfig.xml file

<requestHandler name="/update" class="solr.UpdateRequestHandler" />
Adeeb
  • 1,271
  • 3
  • 16
  • 33
2

Confirmation, this actually worked for me [Win10, solr 5.4.1, java 1.8.0_60]:

$ java -Dauto -Dc=gettingstarted -Drecursive -jar example/exampledocs/post.jar  docs/quickstart.html

resulted into … HTTP ERROR 404 url … as above, I did as recommended:

$ .\bin\solr create -c gettingstarted

& then

$ java -Dauto -Dc=gettingstarted -Drecursive -jar example/exampledocs/post.jar  .\docs

worked for me. Thanks.

J Bordag
  • 21
  • 3
  • This worked for me while running the solr start tutorial. I was missing creating the collection. After running "$ .\bin\solr create -c gettingstarted", I could run "$ java -Dc=gettingstarted -jar example/exampledocs/post.jar example/exampledocs/*.xml" just fine – randombee Feb 23 '16 at 11:23
2

For me the issue was I was using a port other than 8983. I had to include the correct port in my post command.

bin/post -p 1234 -c gettingstarted example/exampledocs/*.xml
curriegrr
  • 566
  • 5
  • 19
0

In solr-5.4.1 I couldn't post to my core either and got this message:

SimplePostTool: WARNING: Solr returned an error #404 (Not Found) for url: http://localhost:8983/solr/gettingstarted/update
SimplePostTool: WARNING: Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/gettingstarted/update. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>
SimplePostTool: WARNING: IOException while reading response: java.io.FileNotFoundException: http://localhost:8983/solr/gettingstarted/update
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/gettingstarted/update...
SimplePostTool: WARNING: Solr returned an error #404 (Not Found) for url: http://localhost:8983/solr/gettingstarted/update?commit=true
SimplePostTool: WARNING: Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/gettingstarted/update. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>
Time spent: 0:00:00.030

I fixed the problem adding the following line to ~/solr-5.4.1/server/solr/corex/solrconfig.xml:

(I added it immediately after the RequestHandlers section header)

<requestHandler name="/update" class="solr.UpdateRequestHandler" />

Then I used (I use a new core name):

$ bin/post -c <core_name> example/exampledocs/money.xml

It worked perfectly. Note that you have to provide the whole path for the .xml file (or any file you wish to upload to solr.)

mshsayem
  • 17,557
  • 11
  • 61
  • 69
Chilly A.
  • 1
  • 1
0

First Create a core :

solr-7.6.0\bin>solr create -c vjcore

then you can see :

Created new core 'vjcore2'

Then navigate to this directory :

solr-7.6.0\example\exampledocs>

java -jar -Durl=http://localhost:8983/solr/vjcore2/update post.jar ipod_other.xml

then go the browser hit this : http://localhost:8983/solr/#/vjcore

your core is created which will contains 2 documents

Hope this will help !

Thanks
-Vj

Vj Singh
  • 31
  • 2