Install Lucene Solar with Tomcat on Windows

May 7th, 2013 by xrigher Leave a reply »

Installing the example solar web application is actually super easy. Here we suppose you already installed the Tomcat sevlet container on your computer TOMCAT_HOME (for example: D:\prog\apache-tomcat-7.0.35). If not, you can download it here http://tomcat.apache.org and install it (at TOMCAT_HOME).

The next step is to install Solar:

  1. download Solr at: http://lucene.apache.org/solr/
  2. extract the solar package into, for example, solr-4.3.0
  3. copy the sample “Solr Home” directory solr-4.3.0\example\solr\ (Note that it’s the folder ‘example\solr\’ itself, not the content under it!!!) into the home directory of tomcat: TOMCAT_HOME if you start tomcat with Tomcat Monitor or into TOMCAT_HOME\bin if you start tomcat with TOMCAT_HOME\bin\startup.bat. Note that the solr hoe directory must be put in the right directory. This is very important!!! Otherwise you will get such an exception: “HTTP Status 500 – {msg=SolrCore ‘collection1′ is not available due to init failure: Could not load config for solrconfig.xml …… ”
    In a word, the solr home directory should be put in the Java current working directory. You can also “Configure the servlet container such that a JNDI lookup of “java:comp/env/solr/home” by the Solr webapp will point to the Solr home”.
  4. copy the solr war file (solr-N.N.N.war) under solr-4.3.0\dist\ as solr.war into the tomcat webapps directory TOMCAT_HOME/webapps. Tomcat will automatically deploy it.
  5. After solr.war is extracted, copy the SLF4j logging jars from solr-4.3.0/example/lib/ext into TOMCAT_HOME/lib or TOMCAT_HOME/webapps/solr/WEB-INF/lib. If this step is ignored, this exception will be thrown out: org.apache.catalina.core.StandardContext filterStart
    SEVERE: Exception starting filter SolrRequestFilter
    org.apache.solr.common.SolrException: Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext directory. For other containers, the corresponding directory should be used. For more information, see: http://wiki.apache.org/solr/SolrLogging

OK. That’s it! Now locate your web browser to http://localhost:8080/solr (Change the port if necessary) and you will see the admin page of solr.

If there are exceptions, check your tomcat logs (such as localhost.YYYY-MM-DD.log) under TOMCAT_HOME\logs\.

PS. actually to install solar on windows is not so much different from that on any other OS. :)

More details can be found on the Solr Wiki: http://wiki.apache.org/solr/SolrInstall

Advertisement

9 comments

  1. wangbz says:

    dear sir:
    I have done all accroding your article.
    But when I visit http://localhost:8080/solr, it is said that
    “The requested resource is not available

    P.S. I can visit http://localhost:8080 correctly.

    How can I figure it out?

  2. wangbz says:

    I have looked the log, it is said:
    “org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error filterStart”

    What is wrong?
    Thanks a lot!

  3. xrigher says:

    Thanks, wangbz, for the comment. I’ve updated the article on the steps of installing Solr.

    First of all, please see step 3, the Solr home directory must be put under the Current Working Directory of Java, which is TOMCAT_HOME is you start tomcat with tomcat monitor, and TOMCAT_HOME\bin if you start with startup.bat.

    Second, on step 4, please remember to rename the solr webb directory from solr-4.x.x into solr.

    And at last, as the added step 5, please copy the necessary SLF4j logging jars into tomcat lib or the webapp lib.

    Hope this will help you solve the problem.

  4. firoz says:

    you are my life saver

  5. Greg says:

    THIS is the ONLY guide to installing Solr and Tomcat on Windows I could find that *actually worked*!!! So thank you sooo much, I’ve been messing around with this for ages.

    No other guide, blog post or tutorial mentions that the Solr home folder needs to be inside the Tomcat home folder.

  6. thanks for the good example on lucene solr

  7. an says:

    Thank you! after messing around with no luck by following instructions from other posts and finally i found this one actually work.

    In addition, if anyone get the error:
    “severe: Error filterStart”

    because you didn’t set up the logging right.Follow this link for logging setup,hope it helps:

    http://wiki.apache.org/solr/SolrLogging#Using_the_example_logging_setup_in_containers_other_than_Jetty

  8. Kara says:

    I am new to java but I managed to install it and tomcat 7 on my win 7 machine. They both work fine. Now I am ready to install Solr (4.7.0) but I keep getting a 404 error when I follow your instructions. Its either the version difference or I might be copying the folders wrong.

    This might sound stupid, but can you clarify what you mean by this:

    “copy the sample “Solr Home” directory solr-4.3.0\example\solr\ (Note that it’s the folder ‘example\solr\’ itself, not the content under it!!!) ”

    So where to create a folder called Solr-home and should I just create empty folders that match the ones in the example/solr folder from the download?

Leave a Reply