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).

CommentFileSizeAuthor
solrconfig+schema.zip24.21 KBsplitsplitsplit
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

I 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?

splitsplitsplit’s picture

Unfortunately 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?

drunken monkey’s picture

So what did you enter for the path in the server settings? Did you maybe include the #? That might lead to the issue.

splitsplitsplit’s picture

Ok 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?

drunken monkey’s picture

Category: Bug report » Support request
Status: Active » Fixed

Good 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.

splitsplitsplit’s picture

Yeah 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

robertgarrigos’s picture

I 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".

zestudio.net’s picture

Thanks robertgarrigos for your post, I had the same problem and removing this fu**** # in the solr path fixed this bug.
Great !

ismailmechbal’s picture

Thanks robertgarrigos you saved my day!

Pene’s picture

#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).

brahimmouhamou’s picture

Pene,

How did you resolve the 400 error?

  • I changed the path to /solr/#/core
  • I changed 'localhost' as host, to my domain

But no result..

Plazik’s picture

#8 and reinstalling module helps me.

geocalleo’s picture

Can 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"?

geocalleo’s picture

Got 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.

agileadam’s picture

Thanks 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

Fernly’s picture

#15 did it :) thanks!

shuai’s picture

#15

Did it too. Thanks. :)

NG@GE’s picture

Status: Closed (fixed) » Needs review

Hi,
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

drunken monkey’s picture

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...

First 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?

drunken monkey’s picture

Status: Needs review » Active
NG@GE’s picture

Hi,
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

drunken monkey’s picture

I have Solr 5.5.0.

Please 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.

NG@GE’s picture

Hi,
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

drunken monkey’s picture

Status: Active » Fixed

OK, thanks for that!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

geerlingguy’s picture

Same 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.

Marko B’s picture

There 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.