Linux – How to fix Tomcat missing SLF4j logging jars

linuxsolrtomcat

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.

Best Answer

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.