I have big problems installing Solr 4.3 under Ubuntu 12.04. Firstly i installed tomcat. I can access tomcat via browser on localhost:8080. Into "Tomcat Web Application Manager" i try to install Solr 4.3 via 2solr.war" file. The file is been uploaded an deployed. But i cant get it started. "FAIL - Application at context path /solr could not be started".
The log file (localhost.log
) look like:
07.05.2013 11:05:36 org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: start: Starting web application at '/solr'
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext filterStart
SCHWERWIEGEND: 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
at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:105)
... 33 more
07.05.2013 11:05:36 org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext filterStart
SCHWERWIEGEND: 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
at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:105)
... 21 more
catalina.....log
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error filterStart
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/solr] startup failed due to previous errors
07.05.2013 11:05:36 org.apache.catalina.startup.HostConfig checkResources
INFO: Reloading context [/solr]
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr] has not been started
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error filterStart
07.05.2013 11:05:36 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/solr] startup failed due to previous errors
Can somebody help me and tell me what to do?
As the logs say - Could not find necessary SLF4j logging jars.
You are missing the slf4j jars.
Place the slf4j
jars in the $CATALINA_BASE/lib
folder. For more information have a look here
If you don't want to copy stuff around, you can modify your CLASSPATH variable, to include all the relevant stuff.
This is an example what you can do:
cd /tmp
wget http://www.slf4j.org/dist/slf4j-1.6.6.zip
unzip slf4j-1.6.6.zip
mv slf4j-1.6.6/integration/lib slf4j
CLASSPATH="`find /tmp/slf4j/ -type f | xargs echo | sed 's/ /:/g'`"
That will give you something like:
# echo $CLASSPATH
/tmp/slf4j/slf4j-api-1.6.99.jar:/tmp/slf4j/slf4j-simple-1.6.99.jar:/tmp/slf4j/slf4j-simple-1.5.11.jar:/tmp/slf4j/slf4j-simple-1.4.2.jar:/tmp/slf4j/slf4j-api-1.5.11.jar:/tmp/slf4j/slf4j-simple-1.5.4-SNAPSHOT.jar:/tmp/slf4j/slf4j-nop-1.5.6.jar:/tmp/slf4j/slf4j-1.6.6.zip:/tmp/slf4j/slf4j-simple-1.5.0.jar:/tmp/slf4j/slf4j-api-2.0.99.jar
You can set variable CLASSPATH in your tomcat's /etc/default/tomcat7 (or on RHEL distros /etc/tomcat7/tomcat7.conf). So, when tomcat starts, you will see something like this in catalina.out:
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-nop-1.5.6.jar!/org/slf4j impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-simple-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-simple-1.5.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-simple-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-simple-1.5.4-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/tmp/slf4j/slf4j-simple-1.6.99.jar!/org/slf4j/impl/StaticLoggerBinder.class]
I think setting up variable is much cleaner way to maintain your system then copying stuff around.
If you want, you can offcourse use the libs from slf4j package (check where are they installed with dpkg -L libslf4j-java / rpm -ql slf4j, and take jars from /usr/share/java). You will also have benefit of being able to upgrade your slf4j (and other libs you "include" via CLASSPATH variable) with system tools (apt-get/yum).
Hope this helps.
PS. If you use Debian/Ubuntu, there's an additional step - you have to modify your JAVA_OPTS to contain:
JAVA_OPTS="${JAVA_OPTS} -classpath ${CLASSPATH}"
for this to work. It seems Debian/Ubuntu don't have config variable CLASSPATH as RHEL-based distros.
You need to do exactly what these messages say in your log files:
Copy the SLF4j
logging jars from <solr>/example/lib/ext/*.jar
into Tomcat Lib (e.g. TOMCAT_HOME/lib
, /usr/share/tomcat/lib
) or Webapp Lib directory (e.g. TOMCAT_HOME/webapps/solr/WEB-INF/lib
). These jars will set up SLF4J
and log4j
.
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
In other words to make your Solr working properly with Tomcat, you need to:
Copy the SLF4j logging jars from <solr>/example/lib/ext/*.jar
into Tomcat Lib (e.g. TOMCAT_HOME/lib
, /usr/share/tomcat/lib
) or Webapp Lib directory (e.g. TOMCAT_HOME/webapps/solr/WEB-INF/lib
). These jars will set up SLF4J and log4j.
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
.
For example:
# cp -v /opt/solr-4.10.4/example/lib/ext/*.jar /usr/share/tomcat?/lib/
or:
# cp -v /opt/solr-4.10.4/example/lib/ext/*.jar /var/lib/tomcat7/webapps/solr/WEB-INF/lib/
Alternatively set-up your CLASSPATH
to point to your jar files.
Copy the logging config from solr/example/resources/log4j.properties
into a location on the classpath. Usually you can use the same location as the jar files above and 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
Restart Tomcat (e.g. sudo /etc/init.d/tomcat7 restart
).
If you still have the problems, it might help to start the server with -Dlog4j.debug=true
to see more details.
See: Using the example logging setup in containers other than Jetty