Sunday, June 3, 2012

Installing Apache Solr on Windows with Tomcat

1) JDK

Install java development kit  preferably version 1.6 or greater.


As a complete web dev environment for windows i recommend using XAMPP. It comes with built in Tomcat servlet, so you won't have to waste your time installing tomcat. Well regarding version of tomcat, i have successfully tested solr on tomcat 5,6 and 7.
     Tomcat can be managed from xampp control panel or you can install it as a windows service so that it can be run independently from xampp. Well doesn't matter much whether it is xampp service or a windows service. To install it as a windows service run the 'service' batch file in c:\xampp\tomcat\bin .
     After installation to check if tomcat is running open you browser and ping

Xampp download

3) Solr install

Download the latest solr release which is currently solr 3.6. Download the tarball from here and extract it to say  downloads\apache-solr-3.6.0

a) Preparing solr home directory

  1. Make a new directory in C:\ and name it solr.
  2. Copy dist and contrib directories from downloads\apache-solr-3.6.0 i.e. downloads\apache-solr-3.6.0\dist and downloads\apache-solr-3.6.0\contrib to C:\solr\dist and C:\solr\contrib
  3. Make a directory named solr inside C:\solr and copy  downloads\apache-solr-3.6.0\example directory contents to it. Now C:\solr\solr is what is called solr home.

b) Configuring tomcat to detect solr

  1. Copy  downloads\apache-solr-3.6.0\dist\apache-solr-3.6.0.war file to C:\xampp\tomcat\webapps directory and rename it to solr. If tomcat service is on you will find that a solr directory is automatically created. If tomcat is off don't bother it would be created next time tomcat starts.

2.    Now run C:\xampp\tomcat\bin\tomcat7w.exe (7 is for the version), select java tab and in java options pane write -Dsolr.solr.home=C:\solr\solr . Click OK and configuration is done. Restart tomcat.

c) Test solr

In your browser enter localhost:8080/solr/admin and you will see.

That's it. Solr is installed and now it can be used to do fast searching on huge amount of data from any source be it a sql database or a file. But to do that a lot of work still needs to be done related to request handlers and schemas. In the future posts i will be talking about the internals of solr.

Note : If you get errors like no cores were created or unable to load class java.* error, that simply means that you made mistake in either providing solr home path correctly in tomcat7w.exe or you forgot to copy dist and contrib folders to c:\solr.

 Post your queries if you have issues installing solr.


  1. i followed the instructions. I can to the solr home page but when I click admin I get the "missing core name in path" i did copy the dis and contrib files to my solr home file and still get the same error.

    Any other ideas?

    1. Can you give some more info on what platform you are using, solr version, JDK version, a snapshot of the java errors(cores not created etc.) you are getting and solr directory structure you have...

    2. i got the similar problem. please help

  2. i got it this time.. I went back getting the info you needed and realized I was one solr file too deep. i removed the contents and delete the extra solr file and for now, it work.

    Will try and integrate drupal now.

  3. this was an excellent article.. I got drupal apachesolr connected now.. Still more testing to see if everything indexes

  4. All of this worked fine until the last step (latest version of all programs, on Win8-64. There I get:
    collection1: Can't find resource 'solrconfig.xml' in classpath or 'solr\collection1\conf/', cwd=C:\xampp
    And I double-checked solr the home path in tomcat7w.exe and DID the dist and contrib folders to c:\solr. Any other ideas?

    1. i got the same issue. what's the fix for your side?

  5. And btw - there is a solrconfig.xml in C:\solr\solr\solr\collection1\conf. Is that the right folder?

  6. i am not able to find

    downloads\apache-solr-3.6.0\dist...where is it??

    1. I am also not able to find dist folder. Any help?

  7. Hi,

    When trying to invoke the Apache Tomcat 7 properties dialog(by clicking 'C:\xampp\tomcat\bin\tomcat7w.exe '), I get the message

    'Service does not exist as an installed service. Unable to open tomcat7w'. Am running it as administrator. Am able to start it fine through the XAMPP control panel though, but there doesn't seem to be a way to invoke the dialog from the control panel. Am using XAMPP portable version.

    What could be wrong here..? Please help.

    1. If you go to the Tomcat root folder C:\xampp\tomcat\, there is a tomcat_service_install.bat. Click that, and then click C:\xampp\tomcat\bin\tomcat7w.exe

  8. Was able to figure out the starting tomcat7w issue but when going to:

    localhost:8080/solr/admin, get the following error. Any ideas?
    I have both solar path correctly set in tomcat7w.exe and dist and contrib folders are in c:\solr.

    HTTP Status 404 - missing core name in path
    type Status report
    message missing core name in path
    description The requested resource is not available.

  9. I was getting the same error.

    The instructions here said to copy the files from the example folder into your solr home. This did not work for me.

    I then tried copying the files from the examples/solr folder to my solr home. This solved my problem.

    1. Yes this is what i did. Please update the article for other readers.

    2. Thanks Steven! I've been trying like mad to get the solr admin page through tomcat and struggled the whole of yesterday....until i read your suggestion. Thanks again. Your solution worked for me....:-)

  10. I downloaded solr-4.2.0.. I followed above steps.. It worked for me.. Its great.. Lots of thanks for the author

  11. When I run the test to the localhost..the SOLR admin screen comes up with Spinning icon that says "Loading" Any clues on what Im doing wrong? Thanks!

    1. Where does it show loading and do you see any errors ?
      Please attach a screenshot of the browser window when you query and also solr log files which are named 'catalina' and placed in Tomcat installation directory. Without those it is impossible to find out what is wrong.

    2. Im sorry but I dont see how to attach a screenshot or log file only Publish and Preview...

    3. Copy paste the contents of the log file on 'pastebin' or something and post the link here.


    5. My problem was actually IE8...instead of IE9 and Solr 4.2.1. I rolled back to 3.6.2 and everything works...Thanks for the very nice tutorial! Jeff

  12. This comment has been removed by the author.

  13. anyone got any ideas on how to get tika 1.3 integrated with solr 3.6.2 and drupal7 using the Apache Solr Attachments module to work? I have been running into problems getting this to work for a couple of weeks now.

    The error I get is:

    Exception occurred sending D:\Webs\drupal\www\drupal\sites\all\modules\apachesolr_attachments\tests\test-tika.pdf to Solr "500" Status: Could not initialize class org.apache.pdfbox.pdfparser.PDFParser java.lang.NoClassDefFoundError: Could not initialize class org.apache.pdfbox.pdfparser.PDFParser at org.apache.pdfbox.pdmodel.PDDocument.load(

    There is a bunch of other info excluded but this is the heart of it. Anyone have any ideas?

  14. Nice article..

    but if are really new to java or solr or would just like to tryout solr rather than worry about dev conf then I suggest go for bitname-solr-stack, its one click installer and eassy to use

  15. Hi, I found this link which also offers solr installation steps very clearly. Hopefully useful to you and your visitors, so sharing it here...


  16. -Dsolr.solr.home=C:\solr\solr where i can give this command ,,,,because i am using tomcat 7 zip file so ,,,i never find the properties,,,,pls give me suggesitions,,,,,,,,thanks

  17. Not working

  18. I really appreciate the information shared above. It’s of great help. MaxMunus provides Remote Support For Corporate and for Individuals. If anyone is facing any issue in his project of #APACHE SOLR we can support them remotely , kindly contact us
    MaxMunus Offer World Class Industry best Consultant on# APACHE SOLR. We provide end to end Remote Support on Projects. MaxMunus is successfully doing remote support for countries like India, USA, UK, Australia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain, and UAE etc.
    Skype id: saurabhmaxmunus
    Ph:(0) 8553576305/ 080 - 41103383