2

I am getting this error when trying to start a new application using Tomcat:

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

I'm not using Jetty, I'm using Tomcat, so my installation instructions are slightly different.

I've checked the link and read extensively on this - it seems like the libraries need to go in $CATALINA_BASE/lib - which in my case should be:

/usr/local/easy/share/easy-tomcat7/lib

However I've put the libraries there - no dice.

This is the lib directory:

./                        commons-io-2.3.jar        jsp-api.jar                 slf4j-api-1.7.6.jar      tomcat-juli-adapters.jar
../                       el-api.jar                jul-to-slf4j-1.7.7.jar      slf4j-api-1.7.7.jar      tomcat-juli.jar
annotations-api.jar       httpclient-4.3.1.jar      log4j.jar@                  slf4j-log4j12-1.7.7.jar  tomcat-util.jar
catalina-ant.jar          httpcore-4.3.jar          log4j-over-slf4j-1.7.7.jar  tomcat-api.jar           wstx-asl-3.2.7.jar
catalina-ha.jar           httpmime-4.3.1.jar        log4j.properties            tomcat-coyote.jar        zookeeper-3.4.6.jar
catalina.jar              jasper-el.jar             log4j.properties.bak        tomcat-i18n-es.jar
catalina-tribes.jar       jasper.jar                noggit-0.5.jar              tomcat-i18n-fr.jar
commons-collections.jar@  jasper-jdt.jar@           servlet-api.jar             tomcat-i18n-ja.jar
commons-dbcp.jar@         jcl-over-slf4j-1.7.7.jar  slf4j-1.7.7/                tomcat-jdbc.jar

As you can see, all the libraries should be there.

So what's causing this? Am I in the wrong Tomcat directory? Did I not grab the correct files? Is there some configuration setting I'm missing? I'm pretty much totally lost here.

2 Answers 2

1

It is not a good idea to have two versions of the slf4j api library in your classpath. You have slf4j-api-1.7.6.jar as well as slf4j-api-1.7.7.jar in it.

Also, you should have the corressponding slf4j implementation library in your classpath.

Refer to the slf4j documentation to get more details on how to include slf4j in your application.

2
  • I've gotten rid of 1.7.6, and set my CLASSPATH variable to: CLASSPATH=.:/usr/local/jdk/lib/classes.zip:/usr/local/easy/share/easy-tomcat7/lib/slf4j-api-1.7.7.jar and I'm still getting errors. Aug 19, 2014 at 17:54
  • Do you have an slf4j implementation in your classpath? What is the error you get?
    – stoeff
    Dec 9, 2014 at 20:23
0

To make your Solr with Tomcat working properly, you need to:

  1. 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.

  2. 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

  3. 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .