SOLR-4771: Throw a more specific exception when SLF4J logging jars cannot be found on the classpath.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1476362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2013-04-26 19:52:54 +00:00
parent 2db8c9aa1b
commit e53378bac6
1 changed files with 15 additions and 1 deletions

View File

@ -48,6 +48,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.Aliases;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Replica;
@ -87,7 +88,7 @@ import org.slf4j.LoggerFactory;
*/
public class SolrDispatchFilter implements Filter
{
final Logger log = LoggerFactory.getLogger(SolrDispatchFilter.class);
final Logger log;
protected volatile CoreContainer cores;
@ -97,6 +98,19 @@ public class SolrDispatchFilter implements Filter
private static final Charset UTF8 = Charset.forName("UTF-8");
public SolrDispatchFilter() {
try {
log = LoggerFactory.getLogger(SolrDispatchFilter.class);
} catch (NoClassDefFoundError e) {
throw new SolrException(
ErrorCode.SERVER_ERROR,
"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",
e);
}
}
@Override
public void init(FilterConfig config) throws ServletException
{