I am using apachesolr-6.x-1.0-* with SolrPhpClient.2009-03-11.tgz and solr-2009-04-15.gz. I have unpacked apachesolr-6.x-1.0-* under Drupal directory, unpacked SolrPhpClient within the apachesolr directory created in Drupal directory. I then, unpacked apache-solr-nightly under my home directory.

I have enabled required modules in the site and I am able to run "java -jar start.jar", I can see Solr admin page. Now when I go to Drupal, it says it cannot connect to Apachesolr, please let me know if I am doing anything wrong.

In addition, I am having to everytime use 'ctrl-c' to stop solr server running in my directory, is there a cleaner way to stop the solr server?

Thanks much for any help,
-- Sai

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaelj’s picture

Make sure that files SolrPhpClient are downloaded from http://solr-php-client.googlecode.com/svn/trunk/Apache/Solr/, this was the reason in my case.

sthumuluri’s picture

That is where I have downloaded the file from, still the same issue.

pwolanin’s picture

you need rev 6, which unfortunately (due to mis-communication with that project) is NOT the available .zip download.

pwolanin’s picture

Status: Active » Closed (fixed)
picardo’s picture

Hi there,

I am having the same problem and I downloaded the version 6 from the link above, but the error message hasn't changed. I even restarted the Apache server. Can you tell me what I am omitting?

robydago’s picture

Version: 6.x-1.0-beta7 » 6.x-1.0-rc4
Status: Closed (fixed) » Active

I had the same problem on CentOS 5.4 with apachesolr-6.x-1.0-rc4.
Disabling selinux fixed it.

robertDouglass’s picture

Ahh, selinux. How we love you.

For the record, we're now at r22 for the SolrPhpClient (there's a r23 too, but the ApacheSolr module checks for specific versions, so stick with r22 for now)

pwolanin’s picture

Have heard of other people having problems with selinux also do to restrictions on ports like 8080 or 8983

BetoAveiga’s picture

I did a new & clean Drupal 6.15 install, and followed all the instructions, the module says the version is right, but this message shows "Apache Solr: Your site was unable to contact the Apache Solr server."

I'm starting to think that the problem could be somewhere else... I have my site hosted with Bluehost... could that be a problem?

thanks!

janusman’s picture

Just a comment: running Solr via Jetty and enabling the coherent_access and apachesolr_nodeaccess modules on a site caused this error to pop up, but only during searches. This because the permissions were making the query request exceed 4096 characters (the default limit on Jetty). I'm assuming there will be other cases where the query length will be too long and cause this message to show.

ikeman’s picture

I am also getting this error on a new install on Cent OS 5.4 64 bit (Apache Solr: Your site was unable to contact the Apache Solr server.)

However, the issue is strangely erratic and appears to be a problem with the ping callback. Solr isn't complaining at all and I've tried it with both jetty and tomcat on both localhost and another machine. Always the same behavior. The drupal site complains that it can't contact the solr server, but simply refreshing the page (I'm just using the admin/site configuration/apache solr/ settings tab to refresh) will eventually report (Apache Solr: Your site has contacted the Apache Solr server). I was even able to build the indexes manually with patience.

I have error reporting on the content page, but I get a empty popup error on load.

I'm running solr 1.4.0 with drupal apache solr 6.x-1.0 and SolrPHP client r22. I have selinux disabled on the Cent OS servers.

It certainly doesn't seem to solr related as the logs on the solr side look identical whether or not the error is reported on the drupal side.

Anyone seen this behavior before? Any thoughts?

Junro’s picture

Hello,

I have a dedicated server and installed apache-solr-nightly under my home director.

I have Your site was unable to contact the Apache Solr server too.

I have enabled required modules in the site and I am able to run "java -jar start.jar"/cite>, but I can't see Solr admin page. What URL I should use for it?

http://localhost:8983/solr/admin/ is for local installation,

so I should use?

http://IP_adress:8983/solr/admin/ ?

with in /admin/settings/apachesolr :

Solr host name : IP_adress of my dedicated server (I that correct?)

Solr port : 8983 (I that correct?)

Solr path : /solr

Any help will be apprecied! Thanks :)

pwolanin’s picture

@Junro - yes, of course, you have to use the remote IP or hostname to see the admin screen if Solr is not on your localhost.

Junro’s picture

http://my_server_ip:xxxx/solr/admin/ doesn't work.

It's wird because I was able to run "java -jar start.jar" so it should work, right?

pwolanin’s picture

@Junro - depends on firewall settings, etc - perhaps you should try getting it working locally first.

ikeman’s picture

Junro, it probably is a firewall issue. You should be able to open the port up to verify.

My issue is a bit more focused and seems localized to the drupal admin interface as search on the site itself is working. Also, the search w/in the query interface of solr admin is working fine.

The problem is in the drupal admin interface, I'm repeatedly getting the "unable to connect..." message. Refreshing, sometimes once, sometimes more, makes the issue disappear. It's like the solr.ping is failing, but it's really not, perhaps the page change is happening before the ping returns?

One simple way to test is to repeatedly hit the "Apache Solr Search Index" link under admin -> dashboard -> reports. For me it works about 50% of the time, the other 50% it responds with "No Solr instance available when trying to clear the cache." which is of course ridiculous. There's not a single error being reported on the solr side and I turned on debug logging for the whole .solr class (don't do this unless you want really big log files) and it simply seems at though the drupal admin has just given up which is why I think it's in the solr.ping check.

Not sure if anyone else has noticed this behavior?

Junro’s picture

it probably is a firewall issue. You should be able to open the port up to verify.

Allright, but how I could do that? Wich firewall are you talking about?

Thanks :)

robertDouglass’s picture

Junro - you need the port in your URL too. If you're using Jetty then it's 8983, if Tomcat 8080. http://my-ip-address:8983/solr/admin

Junro’s picture

Oups, sure I forgot to put it in #14.

I think Solr is unable to contact the Apache Solr server because there is no connection between them. It's a port thing.

The problem is that I don't use Jetty (Maybe it's installed on my server and I don't know it) or Tomcat. I only installed Java.

~ # java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server VM (build 16.0-b13, mixed mode)

Maybe I should use another port?

or maybe I should installed the whole Tomcat thing? or Jetty, but I don't really know what's Jetty is...

robertDouglass’s picture

If you're running java -jar start.jar then you're running Jetty, which is packaged inside of the .jar file. In that case you need port 8983.

Junro’s picture

Ok so everything is well configurated. Port 8983 is blocked by something like a firewall... I'm going to check this. I'm not a guru in server configuration.

Must be Selinux as you said at the beginning of this issue.

I'm going to check if I can disable it.

pwolanin’s picture

@ikeman - that 50% behavior is odd - I have never seen the like. Especially if you are running Solr on the same host, I find it difficult to imagine what could be happening.

rharvin’s picture

After wrestling through the install of Tomcat and Solr on a RHEL 5 machine, a vendor installed this module and couldn't get it to work.

I tried all kinds of changes to the settings, but what eventually worked was using just "localhost" (without the "http://") for the Solr Host name in the module settings tab, along with the port number (I'm using a non-standard port for Solr) and Solr path "/solrpathnamehere"

This cleared up the can't connect message.

Trying domain name and IP address failed, only localhost worked for me.

I set the module to rebuild the index, manually ran cron a few times until the full site was reindexed, and now the search is working as expected.

Junro’s picture

I'm still fighting with solr installation.

But now, my cron problem is fixe!

When I ran the index, I always have 'No Solr instance available when trying to clear the cache.' Cron is well executed but no content is indexed.

I have another problem when I'm saving the settings of a node type: I have a blank page with:

Fatal error: Uncaught exception 'Exception' with message 'No Solr instance available when trying to clear the cache.' in /home/pariscin/www/sites/all/modules/apachesolr/Drupal_Apache_Solr_Service.php:162 Stack trace: #0 /home/pariscin/www/sites/all/modules/apachesolr/apachesolr.module(547): Drupal_Apache_Solr_Service->clearCache() #1 /home/pariscin/www/includes/form.inc(776): apachesolr_clear_cache(Array, Array) #2 /home/pariscin/www/includes/form.inc(416): form_execute_handlers('submit', Array, Array) #3 /home/pariscin/www/includes/form.inc(119): drupal_process_form('node_type_form', Array, Array) #4 [internal function]: drupal_get_form('node_type_form', Object(stdClass)) #5 /home/pariscin/www/includes/menu.inc(348): call_user_func_array('drupal_get_form', Array) #6 /home/pariscin/www/index.php(18): menu_execute_active_handler() #7 {main} thrown in /home/pariscin/www/sites/all/modules/apachesolr/Drupal_Apache_Solr_Service.php on line 162

but the settings are saved.

pwolanin’s picture

Well we should be catching any exceptions - so looks like a different bug - please open a new issue and make sure you are using the latest code.

Junro’s picture

Junro’s picture

I figure out why "Your site was unable to contact the Apache Solr server".
I'm using Jetty but my Solr port 8983 is not listenning:

# netstat -tanpu | grep 8983
#

Jetty seems to be well installed:

# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server VM (build 16.0-b13, mixed mode)

Any idea? Maybe I forgot to do something on my server? restart something? I don't know...

Anonymous’s picture

I had this problem, in my case the Fedore linux box didnt allow httpd to do networking stuff, so that drupal_http_request() (used by apachesolr for Drupal) failed!

The solution was to login as root via SSH, and then type:

setsebool -P httpd_can_network_connect 1

These magic words solved my problem. Add this to documentation?? Thanks!

vanillawater’s picture

Fixed it after setting 'localhost' to '127.0.0.1'.

Thanks.

pwolanin’s picture

Status: Active » Fixed
ChristophWeber’s picture

The command setsebool -P httpd_can_network_connect 1 solved it for me on CentOS 5.2 with standard server install plus necessary packages for Drupal and Solr. Thanks a bunch!

Status: Fixed » Closed (fixed)

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

ataneja’s picture

I am in a problem. I have tried everything, I have read every post/comment...I am running Solr in jetty, and the link http://localhost:8983/solr/admin/ shows the proper web page..But my problem still persists, that is when I enable the solr module in drupal it shows Apache Solr: Your site was unable to contact the Apache Solr server.
I have added SolrPhpClient folder and this output "Apache Solr PHP Client Library: Correct version "Revision: 22"." shows that I have added the right one.

Please tell what all possible reasons may cause this behavior by solr module in drupal.

Thanx

ataneja’s picture

Is there anyone who can help me with the above problem. It will be appreciated.

jpmckinney’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev
Status: Closed (fixed) » Active
_-.’s picture

i'm still seeing this error with Apache Solr 6.x-2.0-beta2

i have

ps ax | egrep -i "solr|java"
1894 ? Sl 0:01 /usr/bin/java -Xmx128m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar
1895 ? Ss 0:00 startpar -f -- solr

svn info /usr/local/apache-solr-1.4.x
Path: /usr/local/apache-solr-1.4.x
URL: http://svn.apache.org/repos/asf/lucene/solr/branches/branch-1.4
Repository Root: http://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 988241
Node Kind: directory
Schedule: normal
Last Changed Author: koji
Last Changed Rev: 985490
Last Changed Date: 2010-08-14 06:47:11 -0700 (Sat, 14 Aug 2010)

and,

cat /usr/local/apache-solr-1.4.x/drupal/solr/solr.xml 
 <?xml version="1.0" encoding="UTF-8" ?>
 <solr persistent="false">
  <cores adminPath="/admin/cores">
    <core name="mysite"  instanceDir="mysite" />
    <core name="mystie2" instanceDir="mysite2" />
  </cores>
</solr>

@ https://my.site.com/admin/settings/apachesolr, i have config of,

Solr host name: 127.0.0.1
port: 8983
Solr path: /solr/mysite

but see messages:

* Login successful.
* Apache Solr PHP Client Library: Correct version "Revision: 22".

* Apache Solr: Your site was unable to contact the Apache Solr server.

^^^^^^

_-.’s picture

I've reproduced as well with Apache Solr 6.x-1x-dev, as reported in this issue.

_-.’s picture

resolved 4 me.

The 'fix' was the combo of:

apachesolr -6.x-2.x-dev module
SolrPHPClient svn -r22
apache Solr 1.4.1 RELEASE (not a nightly build, or build from source)

i.e., not all version combos work, even from similar/close versions. ymmv.

yngens’s picture

Hi All,

Seems I have installed everything, but can't get it working.

I have Java 1.6.0_20 (probably this is the cause?)

java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
root@host:/usr/local/share/apache-solr/example#

Running sudo java -jar start.jar gives failed SocketConnector error:

root@host:/usr/local/share/apache-solr/example#
sudo java -jar start.jar
2010-10-07 23:30:43.466::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2010-10-07 23:30:43.605::INFO:  jetty-6.1.3
2010-10-07 23:30:43.640::WARN:  failed SocketConnector @ 0.0.0.0:8983
java.net.BindException: Address already in use
...
[13]+  Stopped                 sudo java -jar start.jar

http://mysite.com:8983/solr/admin does not react at all. I have checked firewall and 8983 is not blocked.

What kind of advise you could give to me?

pwolanin’s picture

read the error message:

"java.net.BindException: Address already in use"

something else in your system is using that port.

yngens’s picture

Thanks for suggestion. I have checked port #8983. Nothing else is using it. In fact it was blocked, I opened it specifically for this module to work. Unfortunately, I can't make it work on my server. It is freshly installed CENTOS 5.5 i686 standard, so nothing else should be keeping that port busy. Does nyone know what for port #8983 is used for in CENTOS 5.5 i686 standard?

gabidrg’s picture

I also had this issue, but managed to get it working. Here is my working multicore Solr setup and the two mistakes that I did.

- CENTOS 5.5 i686
- Pressflow 6.19
- Apache Solr 1.4.1 Release (not nightly)
- Tomcat 5
- Varnish 2.0.6
- Apache Solr Search Integration 6.x-2.0-beta3
- Apache Solr PHP Client Library REV22

Used this great guide to set it up: https://wiki.fourkitchens.com/display/PF/Configure+Varnish+for+Pressflow

Basically, Tomcat runs restricted to 127.0.0.1:8080, Varnish has backend setup for Tomcat (127.0.0.1:8080) and listens to port 8983 for a limited number of IPs (127.0.0.1 and several other IPs).

Problem no.1: permissions - check that all config files in Solr dir are accessible and executable by Tomcat user.
Problem no.2: core configuration files - make sure that you have the right schema.xml and solrconfig.xml files, not the Solr example files, but copied from Apache Solr Search Integration Drupal module into the location where Drupal Solr is setup (mine is /var/solr, so I have /var/solr/core1/conf/schema.xml etc.)

A good indicator of whether things are setup correctly is to use PING feature from Solr admin. It may be that the admin interface for cores is working, but pinging not.

Under Solr Drupal settings I have:
- Solr host name: 127.0.0.1
- Solr port: 8983

yngens’s picture

Do I have to install Varnish 2.0.6? It doesn't say anything about Varnish on Apache Solr module installation page.

gabidrg’s picture

No, you don't have to, I use this setup mainly for performance. In the above setup, but without Varnish installed, I would simply use Tomcat port:
- Solr host name: 127.0.0.1
- Solr port: 8080

yngens’s picture

Alas, it is not working. On mysite.com:8983/solr/admin I have this message

HTTP ERROR: 404

NOT_FOUND
RequestURI=/solr/admin

Powered by jetty://

Running java -jar start.jar still gives:

2010-10-21 02:00:48.481::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2010-10-21 02:00:48.621::INFO:  jetty-6.1.3
2010-10-21 02:00:48.656::WARN:  failed SocketConnector @ 0.0.0.0:8983
java.net.BindException: Address already in use

and I don't know how to free that socket or port. Searching does not give anything on this.

How do I comply with your #1 check that all config files in Solr dir are accessible and executable by Tomcat user? What exact permissions I should attribute to files?

yngens’s picture

Status: Closed (fixed) » Active
Issue tags: -java, -ubuntu, -Apache Solr Search, -Tomcat6

After reinstalling everything, I've got it working through socket and port, but hitting new error message:

INFO: JNDI not configured for solr (NoInitialContextEx)

yngens’s picture

gabidrg, unfortunately using - Solr host name: 127.0.0.1 and - Solr port: 8080 did not help my situation. Does configuring Apache Solr with Tomcat and not with Jetty mean just using port #8080? I encountered lot's of problems with Jetty, now would like to try to get Apache Solr working with Tomcat, but could not find any instructions for this method. Should I install everything as usual, just using Tomcat port or there is something else which has to do with Tomcat? And how I reach Apache Solr admin page in this case, since http://localhost:8080/solr/admin/ gives:

HTTP Status 404 - /solr/admin/

type Status report

message /solr/admin/

description The requested resource (/solr/admin/) is not available.

Apache Tomcat/5.5.30
gabidrg’s picture

This is a nice guide to setup Solr with Tomcat https://wiki.fourkitchens.com/display/PF/Configure+Varnish+for+Pressflow . The good thing with Varnish, is that you can allow connectors to Solr admin from specific IPs, so that you can access the admin interface of Solr.

yngens’s picture

Issue tags: -java, -ubuntu, -Apache Solr Search, -Tomcat6

If anyone running

netstat -an | grep 8983 | grep CLOSE_WAIT

gets lots' of CLOSE_WAITs, then you've hit this wall: http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=10944... just like I was insistently hitting for several days. Because, believed that I downloaded the right versions of the soft. Well, I was wrong - today I finally have multicore apache solr search working on my 64 bit CentOS server. The right combination of the module, package, apache solr, java made the trick. But it was quite hard to find that right combination taking into account that many links here, on the official page of the module, and on other sites, offering different methods of installing Apache Solr search on Drupal, are broken.

So, to save all of you, guys, who are on 64 bit CentOS, from repeating my mistakes I list my combinations of the software, which properly functions:

java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
root@host:/opt/apache-solr/example/solr#

Apache Solr search 6.x-2.x-dev

svn checkout http://svn.apache.org/repos/asf/lucene/solr/branches/branch-1.4 apache-solr

http://apache.cyberuse.com//lucene/solr/1.4.1/apache-solr-1.4.1.tgz

mrgoltra’s picture

Ok... after struggling with this for days.

Setup

Ubuntu 10.04
Tomcat 6
apache-solr-1.4.1 (non-nightly)
Apache Solr search module 6.x-2.x-dev
Apache Solr PHP Client Library: "Revision: 22".

multicore solr.xml config

<?xml version="1.0" encoding="UTF-8" ?>					
<solr persistent="false">					
<cores adminPath="/admin/cores">					
  <core name="mysite1" instanceDir="mysite1" /> 		
  <core name="mysite2" instanceDir="mysite2" />					
</cores>					
</solr>					

login to tomcat and click on the /solr this will give you the multi core admin page (to make sure your solr.xml works)

go to the apache solar search config page and I used the following settings

localhost
8080 (using tomcat)
/solr/mysite1.com

hope this helps.

* note you need to be logged in yoursite:8080/tomcat_manager_page when you save the configuration page. Don't know why?

10/29/10 **UPDATE. Never mind the .com in the path /solr/mysite1. You will be able to set this as long as you are logged in to the sorl/admin page via tomcat manager page. I have also noticed that the connection will drop at one point. I am not sure why. I also have noticed that tomcat is not accessible via 8080. I will need to restart the service.

jthomasbailey’s picture

This helped me: If you can get to the Admin Page (your IP:8983/solr/admin/) the path you should use in your settings is right at the top: "SolrHome=solr/ "
It's stupid but it took me hours to figure that out. I had it pointing at "opt/solr/example" instead of at simply "solr/"

jrz’s picture

Issue tags: +java, +ubuntu, +Apache Solr Search, +Tomcat6

Hi All,

I've successfully installed apache solr on my windows/apache server. The admin side of things work great when I run the start.jar file. However. I need to make this file run constantly in the background. Has anyone created a windows service for this file?

Cheers

BeaPower’s picture

WORKED FOR ME FINALLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

For all those who can't get it to work try this:

o compile it yourself get ANT:

# apt-get install ant

or

# yum install ant

and in root of solr run:

# ant example

It will take a while to compile and when it's finished

# cd example

Now check if solor.war exists in webapps dir:

[root@xxxxxx example]# ls -l webapps/
total 4012
-rw-r--r-- 1 root root 4102706 Sep 2 15:35 solr.war

And try running solr again:

# sudo java -jar start.jar

http://janaksingh.com/blog/apachesolr-search-drupal-centos-107

ahoglund’s picture

These instructions fixed the issue for me as well. Thank you!

jpmckinney’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

Richard Rothwell’s picture

Status: Active » Closed (fixed)
Issue tags: +java, +ubuntu, +Apache Solr Search, +Tomcat6

In my particular case on Mac OS X Snow Leopard I discovered that their was a code mismatch. Aka a bug.

The Solr client library constructor for class Apache_Solr_Response expects the first item in the response header array to be of the form of a HTTP response status line. E.g. HTTP/1.0 200 OK
Line 124: while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP')

This line is synthesised by class Drupal_Apache_Solr_Service in the method _makeHttpRequest. This is the code:

$headers[] = "{$result->protocol} {$result->code} {$result->status_message}";

But it seems $result comes from drupal_http_request and it does not provide $result->protocol OR $result->status_message.
So instead of "HTTP/1.0 200 OK" it produces just "200".

The end result is that the code 200 is not parsed properly in Apache_Solr_Response and so the value is set to zero.

When Drupal_Apache_Solr_Service::ping is called it looks for the status code, does not get 200 and so ping returns false.
See:
if ($response->getHttpStatus() == 200)

The apparent connection failure follows from that.

The fix is on line 376 of Drupal_Apache_Solr_Service.php insert the following:

$result->protocol = isset($result->protocol) ? $result->protocol : 'HTTP/1.0';
$result->status_message = isset($result->status_message) ? $result->status_message : 'OK';

sathishhpk’s picture

You have to configure correctly.

Please use this link for single and multiple site solr search configuration: http://drupal.org/node/484800

adixb’s picture

I can verify that #57 is the case for 6.x-1.x branch using SOLR 1.4 with Tomcat 5.

Nick_vh’s picture

You should seriously consider upgrading then?

adixb’s picture

If an upgrade path were an option, it would have been done.

I'm completely open to someone committing a patch for this, but I'm not going to take credit for someone else's debugging.

adixb’s picture

Ok, no patch has been made for the issue fixed in comment 57, so I've rolled it.

Richard Rothwell (http://drupal.org/user/1914636), please take credit for this somehow.