solr在windows下Tomcat配置
把solr运行起来,还不容易,折腾了不少时间。之前,需要把tomcat/conf/server.xml中的Connector添加UTF-8处理能力:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
1.把刚下载的solr下dist下的apache-solr-xxx.war拷贝到tomcat的webapp下。
2.在tomcat的conf下,创建Catalina/localhost文件夹。
3.在localhost文件夹下,新建solr.xml文件,内容如下:
<?xml version="1.0" encoding="UTF-8" ?>
<Context docBase="c:/Program Files/tomcat-6.0.35/webapps/solr.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="c:/solr" override="true"/>
</Context>
说明:docBase就是刚拷贝过去的solr war绝对路径;Environment name="solr/home"是一个变量名,不用改变,其value就是我们想存放solr配置文件、索引的地方。
4.把solr下example\solr下的所有内容,拷贝到c:/solr下。
5.到这里,如果直接运行tomcat会有报错:
严重: org.apache.solr.common.SolrException: Error Instantiating QueryResponseWriter, solr.VelocityResponseWriter is not a org.apache.solr.response.QueryResponseWriter
查看solrconfig.xml,发现有这样的设置:
<!-- The solr.velocity.enabled flag is used by Solr's test cases so that this response writer is not
loaded (causing an error if contrib/velocity has not been built fully) -->
<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" enable="${solr.velocity.enabled:true}"/>
ok,找到问题,直接设置成false就行。
至此,solr正常运行起来了。
页:
[1]