Tomcat7 0 27下安装Solr4 6 0

               

    应项目经理要求,我们项目需要做搜索的功能。搜索这块的任务交给了我,技术方案是Solr。于是花了一下午时间在比较新的tomcat下装起了一个目前最新的solr。

    安装步骤:

    首先弄到tomcat和solr4.6的包,这自不必说!然后将solr解压在:F:\solr\solr-4.6.0这下面,将tomcat解压在:F:\solr\tomcat7.0.27。同时新建一个solr运行用的文件夹:F:\solr\SolrHome。并将下载的solr包中的example/solr文件夹下面的所有文件放入到F:\solr\SolrHome。同时将solr包里面的:F:\solr\solr-4.6.0\dist\solr-4.6.0.war复制到tomcat里面的webapps文件夹下面,同时改名为solr.war。

    在tomcat的conf/Catalina/localhost下添加solr.xml文件,文件内容如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Context docBase="F:\solr\tomcat7.0.27\webapps\solr.war" debug="0" crossContext="true" >  <Environment name="solr/home" type="java.lang.String" value="F:\solr\SolrHome" override="true" /></Context>
    docbase是solr的war包的绝对地址,value是solr的运行环境。

     双击tomcat的startup.bat,这是tomcat会报错!

[SetContextPropertiesRule]{Context} Setting property 'debug' to '0' did not find a matching property.2013-12-26 20:02:57 org.apache.catalina.core.StandardContext startInternal严重: Error filterStart2013-12-26 20:02:57 org.apache.catalina.core.StandardContext startInternal严重: Context [/solr] startup failed due to previous errors

    但是这个日志让人很蛋疼,就报了个错,啥都没有,最狠这种日志了!!

    在tomcat的logs文件夹下面查了下localhost.2013-12-26.log这个日志文件,才找到了问题的症结!

2013-12-26 20:02:57 org.apache.catalina.core.StandardContext filterStart严重: Exception starting filter SolrRequestFilterorg.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/SolrLoggingat org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:111)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    这不就是缺jar包嘛!!缺slf4j.jar。果断把F:\solr\solr-4.6.0\example\lib\ext这个路径下的所有slf4j相关的jar包拷进了F:\solr\tomcat7.0.27\webapps\solr\WEB-INF\lib这个文件夹,也就是应用的lib文件夹下。同时把solr包下的F:\solr\solr-4.6.0\example\resources\log4j.properties这个日志文件拷近F:\solr\tomcat7.0.27\webapps\solr\WEB-INF\classes。

    重启tomcat!我的solr跑起来了!哈哈!回家。



           

猜你喜欢

转载自blog.csdn.net/qq_44925357/article/details/89436349
0