I\'ve been trying to set up Solr 4.3 on my home PC (in Tomcat 7) but it doesn\'t run. I have set up Tomcat and deployed the solr.war
file which both unpacks and sho
I had some problem doing the same thing, the official documentation is not really helpful about this. I wrote a blog post about it which reads:
Solr install
Download and unpack the latest version of Solr, somewhere on the disk.
cd /tmp
wget "http://mirrors.ircam.fr/pub/apache/lucene/solr/4.6.0/solr-4.6.0.tgz"
cd /opt
sudo tar zxvf /tmp/solr-4.6.0.tgz
sudo chown -R tomcat:tomcat solr-4.6.0
Here, I use /opt, but you can install it anywhere as long as Tomcat has access to it. Just to be sure, make Tomcat the owner, so it can read and write in Solr folders.
Deployment
Now, let's deploy the Solr webapp on Tomcat. To do so, we will take advantage of an XML context configuration file, wich we will use to deploy and configure Solr.
In your Tomcat installation folder, create a new XML context configuration file in conf/Catalina/localhost. The base name of the file will define the Solr context path.
We first need to define ${solr.home}. Here, we use the example Solr configuration provided in the distribution. It is located in /opt/solr-4.6.1/example/solr.
To avoid startup errors, we need to add some jars to the webapp classpath, located in /opt/solr-4.6.1/example/lib/ext. But we don't want to pollute Tomcat's lib folder with Solr jars, so we just declare a virtual loader.
We also need to configure Log4J properly. Here we use the Log4J configuration file provided in Solr distribution in /opt/solr-4.6.1/example/resources, by adding the folder in Solr classpath.
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/opt/solr-4.6.1/dist/solr-4.6.1.war">
<Environment
name="solr/home"
type="java.lang.String"
value="/opt/solr-4.6.1/example/solr"
override="true" />
<Loader
className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="/opt/solr-4.6.1/example/lib/ext/*.jar;/opt/solr-4.6.1/example/resources/" />
</Context>
Save the file, wait for Tomcat to read it and deploy the war.
That's it! Solr is up and running.
The easiest way to get started with Solr on Tomcat is to use HDS (Heliosearch Distribution for Solr), a Tomcat/Solr distribution
It's a super-set of Apache Solr, containing an additional "server" directory that is a pre-configured (threads, logging, connection settings, message sizes, etc) Tomcat based Solr server.
Some other implementation notes:
To start:
$ cd server
$ bin/startup.sh
To start on a different port (e.g. 7574):
$ cd server
$ bin/startup.sh -Dhttp.port=7574
To shut down:
$ cd server
$ bin/shutdown.sh -Dhttp.port=7574
The scripts even accept -Djetty.port=7574 to make it easier to cut-n-paste from start examples using jetty. The "example" directory is still there too, so you can still run the jetty based server if you want.
Check the localhost_yyyy_mm_dd.log logs created by Tomcat. It should typically show you the reason for this issue. Full stack trace might not be displayed in console...
Here is instruction provided by Tony at Drupal for Windows with XAMPP installed:
If you're on Linux, check: Apache Solr 4.6.0 installation.
You need to install the jars for logging as explained here.
Just copy all the mentioned files into your tomcat/lib dir. And restart Tomcat.
- Copy the jars from
solr/example/lib/ext
into your container's main lib directory. These jars will set upSLF4J
andlog4j
. Exactly where this lib directory is highly variable. For a Debian or Ubuntu server using the Tomcat package available from the OS vendor, this is likely to be/usr/share/tomcat6/lib
or/usr/share/tomcat7/lib
.- Copy the logging config from
solr/example/resources/log4j.properties
into a location on theclasspath
. Usually you can use the same location as the jar files above. Edit the configuration file for your preferred log destination.- Optionally, if you did not place log4j.properties on the classpath, set
java option -Dlog4j.configuration=file:///path/to/log4j.properties