Problem
When I try to index items, none are indexed and I get an error 400 Status: Bad Request. A bit of googling revealed this usually to be down to not copying in the solr config from Search API Solr Module, however I done this and it still doesn't solve the problem.
Is this a mis-configuration or a bug?
Set-Up
Ubuntu 12.04 Server
LEMP Stack
Tomcat 7.0.47
Apache Solr 4.5.1
Apachesolr Module 1.5
Search API Solr Search 1.3
(Installed from the following instructions http://www.lullabot.com/blog/article/installing-solr-use-drupal)
Installed Tomcat without problems. Set it to port 8983. Tomcat still running successfully.
Copied across basic solr config files.
Setting up Drupal Core:
- Copied solr 4.5.1 example config to /usr/local/tomcat/solr.
- Removed the three lines listed in the patch from apachesolr module to avoid the solrconfig.xml loading bug. (Issue here https://drupal.org/node/2107417)
- Copied config from apachesolr 1.5 Drupal Module to overwrite example config.
- Created solr core definition
- Created solr/drupal directory and copied in config from apachesolr 1.5 drupal module.
Rebooted Tomcat and assigned all permissions to Tomcat user.
This gives the error 400 status bad request that I'd forgotten about. (had to reinstall solr)
- Removed the three lines listed in the patch from search_api_solr module to avoid the solrconfig.xml loading bug. (Issue here https://drupal.org/node/2107417)
- Copied config from search_api_solr module into solr core config (/usr/local/tomcat/solr) and drupal config (/usr/local/tomcat/drupal/solr).
- Rebooted Tomcat and assigned all permissions to Tomcat user.
But this still gives me the index error, shown in full below. Mis-configuration or genuine bug?
(I attached the schema and solrconfig.xml from my solr core config directory in case it helps as I thought they were most important files. But I'm fairly sure they're just copied from the module with the 3 offending lines for bug mentioned above removed)
Aside from that I can contact the solr server fine and tomcat is working.
SearchApiException while indexing: "400" Status: Bad Request: Bad RequestApache Tomcat/7.0.47 - Error report
HTTP Status 400 - HTTP method POST is not supported by this URL
type Status report
message HTTP method POST is not supported by this URL
description The request sent by the client was syntactically incorrect.
Apache Tomcat/7.0.47
in SearchApiSolrConnection->checkResponse() (line 548 of /srv/www/mysite.net/public/sites/all/modules/search_api_solr/includes/solr_connection.inc).
Comment | File | Size | Author |
---|---|---|---|
solrconfig+schema.zip | 24.21 KB | splitsplitsplit |
Comments
Comment #1
drunken monkeyI don't think this can really be a bug, as no-one else seems to have any problems. On the other hand, I don't see anything wrong with the configuration you describe. (Just note that you don't need the apachesolr module when using the Search API, there are even some compatibility issues when using both. Nothing that could cause this behavior, though.)
The only thing I can think of right now is that you might have set the path, or maybe some other setting, incorrectly in the server settings. Is it
/solr/drupal
? When you go to the URL the server displays (unless you have set up some protection against outside access), does it show the Apache Solr admin UI, a 404 error or something else? In the second case, what happens if you append/select
to that URL?Comment #2
splitsplitsplit CreditAttribution: splitsplitsplit commentedUnfortunately the UI works fine, aside from the fact I get a 404 on indexing it seems to work fine. I've got it on localhost:8983/solr/#/drupal.
I tried re-installing it to no avail, but I did find that if you go onto the files tab of a server I get the following error, could this be related?
Warning: Invalid argument supplied for foreach() in search_api_solr_server_get_files() (line 151 of /srv/www/eslsearch.net/public/sites/all/modules/search_api_solr/search_api_solr.module).
Shouldn't this find the solr config files I loaded?
Comment #3
drunken monkeySo what did you enter for the path in the server settings? Did you maybe include the
#
? That might lead to the issue.Comment #4
splitsplitsplit CreditAttribution: splitsplitsplit commentedOk so I "solved" it.
There was nothing wrong with my solr installation. I'd recently installed a new version of my site on the test server and I installed the search_api_solr module on that. It just worked straight off.
I reinstalled (uninstalled, deleted, re-downloaded, enabled) the module, re-created the servers and that also works fine.
I guess installing the module before the server is fully set-up can cause problems? Or perhaps servers created don't update their settings if you change your solr config after they've been created?
Would it be useful if I wrote up a step by step beginners guide, starting from the Solr Installation guide in the Lullabot article?
Comment #5
drunken monkeyGood that you were able to solve it. I cannot say what could have caused this. Did you try clearing the cache before?
Anyways, there is already an installation guide in the handbook – if you spot any mistakes or things that are missing, it would of course be great if you could amend it.
Comment #6
splitsplitsplit CreditAttribution: splitsplitsplit commentedYeah plenty of times.
The only thing I can think is I might have only put the Search API config in the Solr base install when I'd already created a server and perhaps it didn't update?
I added an example to the documentation which I'm hoping might help past me.
Comment #8
robertgarrigos CreditAttribution: robertgarrigos commentedI had this same error. The problem was having the # in the solr path in the search api config, so it had to be "solr/drupal" and not "solr/#/drupal".
Comment #9
zestudio.net CreditAttribution: zestudio.net commentedThanks robertgarrigos for your post, I had the same problem and removing this fu**** # in the solr path fixed this bug.
Great !
Comment #10
ismailmechbal CreditAttribution: ismailmechbal commentedThanks robertgarrigos you saved my day!
Comment #11
Pene CreditAttribution: Pene commented#8 thanks, it works!
And don't forget to use yourdomain.com instead of localhost at "Solr host" if you use a subdomain.
In case of similar future searches, here is my Drupal log for indexing purposes (Google):
SearchApiException: Could not index items since important pending server tasks could not be performed. in search_api_index_specific_items() (line 1522 of sites/all/modules/contrib/search_api/search_api.module).
SearchApiException while deleting items from server : "400" Status: HTTP method POST is not supported by this URL: HTTP method POST is not supported by this URL<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 400 HTTP method POST is not supported by this URL</title> </head> <body><h2>HTTP ERROR 400</h2> <p>Problem accessing /solr/admin.html. Reason: <pre> HTTP method POST is not supported by this URL</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html> in SearchApiSolrConnection->checkResponse() (line 541 of sites/all/modules/contrib/search_api_solr/includes/solr_connection.inc).
Comment #12
brahimmouhamou CreditAttribution: brahimmouhamou commentedPene,
How did you resolve the 400 error?
But no result..
Comment #13
Plazik CreditAttribution: Plazik commented#8 and reinstalling module helps me.
Comment #14
geocalleo CreditAttribution: geocalleo commentedCan someone be so kind as to let me know how to remove the # from the url path in Solr. If I remove the # I get a 404 not found error.
Could somebody lay out the steps as to how they went about removing the # from the path "solr/#/drupal"?
Comment #15
geocalleo CreditAttribution: geocalleo commentedGot it, in case someone else stumbles on this. The Solr admin app is javascript based from what I can understand. Going from /solr/#/~core/drupal to /solr/drupal in the Search API server settings fixed the problem.
Comment #16
agileadamThanks for confirming geocalleo. This did the trick.
In case anyone is confused, here's an example:
Visit in browser:
http://mysite.com:8080/solr/#/~cores/mycore
Module's "SOLR server URI" configuration:
http://mysite.com:8080/solr/mycore
Comment #17
Fernly CreditAttribution: Fernly as a volunteer commented#15 did it :) thanks!
Comment #18
shuai CreditAttribution: shuai commented#15
Did it too. Thanks. :)
Comment #20
NG@GE CreditAttribution: NG@GE as a volunteer commentedHi,
I am struggling with the same issue and can't seem to make it work.
Replacing 'solr/#/drupal' with 'solr/drupal' makes me lose the connection to Solr...
Any working hint?
Regards
Comment #21
drunken monkeyFirst off, I think the path you configure needs to start with a slash.
Second, this will only work if the core you have configured for the Search API is named "drupal".
Finally, this won't work the same in Solr 3.x, I think, but I hope that's not the issue.
Can you post the URL where you can reach the Solr server in the browser?
Comment #22
drunken monkeyComment #23
NG@GE CreditAttribution: NG@GE as a volunteer commentedHi,
Thanks for taking the time to look at this again!
I have the path with slash at the beginning, sorry for leaving that out.
The core is named drupal too.
I have Solr 5.5.0.
The url where I can reach the Solr server via browser is
hostname:8983/solr
and for the core
hostname:8983/solr/#/~cores/drupal
Comment #24
drunken monkeyPlease use 5.4.1 – as mentioned in the module documentation (though only since a few days ago, admittedly), 5.5 broke compatibility with this module.
Comment #25
NG@GE CreditAttribution: NG@GE as a volunteer commentedHi,
Thanks for the tip! I will replace it then.
Anyway, I came here to write that I finally solved the issue I reported.
What happened was that the core was not properly created via Solr admin, but only by creating the core directory and pasting files in /solr/server/drupal/conf. That being said, weird that the connection was good with the # and not without. Anyway, leaving the feedback here in case someone more or less accidentally skips a step :)
Regards,
NG
Comment #26
drunken monkeyOK, thanks for that!
Comment #28
geerlingguy CreditAttribution: geerlingguy at Midwestern Mac, LLC commentedSame thing here, I accidentally left the
#
in the path and was scratching my head as to why it wouldn't work when indexing but all the admin pages showed a connection (I had/solr/#/my-core-name-here
, needed to change it to/solr/my-core-name-here
).One other thing to note: with the incorrect path, the server information/overview page didn't show the Drupal schema version (even though it reported the server could be reached). With the correct path, it showed the schema version.
Comment #29
Marko B CreditAttribution: Marko B commentedThere are few places where this # is still present. I fixed it here https://www.drupal.org/node/658426 please if you find it somewhere, fix it.