经过一番研究(2days),终于把solr 搭建起来了。由于现在网上的资料实在太旧,所以现在准备写如何搭建solr5.0。
环境:window7
1.安装jdk1.8, tomcat6.0。(jdk1.6不支持啊!)
2.在apace solr官网下载,solr-5.0.0.zip
http://mirrors.hust.edu.cn/apache/lucene/solr/5.0.0/
3.下载后解压后,搜索solr.war,(顺便把D:\solr-5.0.0\contrib下的jar放到war中,有用)
把solr.war放到tomcat的webapps下.
4,把D:\solr-5.0.0\example下文件copy到新建目录D:\Program Files\solrex下
5.在D:\Program Files\Tomcat 6.0\conf下新建D:\Program Files\Tomcat 6.0\conf\Catalina\localhost\solr.xml,没有文件夹新建:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Context docBase="D:/solr-5.0.0/server/webapps/solr.war" debug="0" crossContext="true" >? <Environment name="solr/home" type="java.lang.String" value="D:\Program Files\solrex\example-DIH\solr" override="true" />
</Context>
6.配置D:\Program Files\Tomcat 6.0\conf下server.xml端口
<!--solr-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" disableUploadTimeout="false"/>
7.启动tomcat,可能报错
(1)java.lang.NoClassDefFoundError: Failed to initialize Apache Solr: 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
解决:把D:\solr-5.0.0\dist\solrj-lib\slf4j-api-1.7.7.jar拷贝到tomcat lib下
(2)严重: Exception starting filter SolrRequestFilter
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
解决:去其他地方把commons-logging-1.0.4.jar拷贝到tomcat lib下
(3)多加了jar报错,把D:\solr-5.0.0\dist\solrj-lib\的其他包也copy到了lib
解决:删掉
8.启动tomcat无错后访问http://localhost:8080/solr/
支持html5浏览器效果更好。ie8如下图:
原文地址:http://blog.csdn.net/a472198674/article/details/44100689