Hackked
Hackked

Reputation: 41

How to integrate apache solr with eclipse and Apache tomcat

It is very difficult to get started with apache solr in eclipse.I am new to apache solr was trying to integrate it with eclipse so that I can develop web application for same.I have searched lot of link but nothing useful.I have downloaded apache solr 5.0 but not able to get integrate with eclipse in windows

Please provide any step wise step solution and also provide some good examples.

Upvotes: 1

Views: 3387

Answers (3)

ankur vikash
ankur vikash

Reputation: 1

Since you have asked about Solr5.0, Beginning with Solr 5.0, Support for deploying Solr as a WAR in servlet containers like Tomcat is no longer supported. For information on how to install Solr as a standalone server, please see Installing Solr- https://cwiki.apache.org/confluence/display/solr/Installing+Solr

Upvotes: 0

Make
Make

Reputation: 422

It is very easy if you know all steps.Here I am providing all steps one by one

  1. Install Apache Tomcat 7 or any other and change its port to 84 or your desired port no when installing apache tomcat
  2. Download Solr 4.6 zip and extract it
  3. Copy solr folder from example folder of solr 4.6 and create a folder name solr in C drive and paste content in this folder
  4. Copy solr-4.6 war from dist folder to Tomcat webapps folder and rename it to solr.war automatically solr folder will be created
  5. Copy all war files from dist-->solrj-->lib to tomcat-->lib folder
  6. Inside tomcat-->conf-->Catalina-->localhost create xml file solr.xml

solr.xml

<?xml version='1.0' encoding='UTF-8'?>
<context docBase="C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/solr.war" debug="0" crossContext="true" >
    <environment name="solr" type="java.lang.String" value="/Tomcat 7.0/webapps/" override="true"></environment>
</context>

7. Inside tomcat-->webapp-->solr-->WEB-INF-->web.xml set Environment entry it will look like this

  <env-entry>
   <env-entry-name>solr</env-entry-name>
   <env-entry-value>C:\solr</env-entry-value>
   <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

Now you are all set with apache solr use enjoy

http://localhost:84/solr/#/

Upvotes: 1

Andrea
Andrea

Reputation: 2764

Since you said "I am new to Solr" I think you don't need to load it in Eclipse. Solr is a kind of service so unless you want to develop some customisation (e.g. plugin, search component, parser) which is an advanced topic, it can be started externally from command line.

Then, in Eclipse, you may want to

  • link in your project the folder that contains the configuration files, so you can edit them in Eclipse
  • import the solrj libraries if you need to index data in some way that is not covered by the defaut set of tools that solr offers (e.g. SolrCell, DataImportHandler)

But again, at least for a primer usage, I don't see the need to import and manage it from Eclipse. A compromise could be an external launch configuration (in Eclipse) that hides the command line (for starting and stopping Solr)

Upvotes: 1

Related Questions