在tomcat中运行solr-4.3.0

下载solr 4.3,tomcat,解压等操作不必多说.  

将解压后的solr下的dist目录中的solr-4.3.0.war ,copy到tomcat的webapps目录中,并改名为solr.war

 

Solr uses UTF-8 file encoding. That means that we need to ensure
that Apache Tomcat will be informed that all requests and responses made should use that
encoding. To do that, we modified the server.xml file in the way shown in the following code:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />

 

The third step is to create a proper context file. To do that, create a solr.xml file
in the $TOMCAT_HOME/conf/Catalina/localhost directory. The contents of
the file should look like the following code:

<Context path="/solr" docBase="/usr/share/tomcat/webapps/solr.war"
debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/
usr/share/solr/" override="true"/>
</Context>

以上配置中,docBase为tomcat/webapps/solr.war的路径,下面的路径为下载solr目录中example/solr的路径,根据自己需要更改配置。

这时候运行tomcat会报错     org.apache.catalina.core.StandardContext startInternal SEVERE: Error filterStart

              org.apache.catalina.core.StandardContext startInternal

 上网查了下原因,首先看这个http://wiki.apache.org/solr/SolrLogging   ,solr4.3的war包中不包含任何日志的jar包,你需要自己手动添加。将solr目录下example\lib\ext中的jar包copy到tomcat的lib中。这时候虽然添加jar包,但是没有对应的日志配置,需要将example\resources中的log4j.properties也放到tomcat/lib中。当然,你可以根据自己的需要更改配置。

 

启动tomcat,可以看到日志信息,确认已经成功启动  打开 http://localhost:8080/solr/ 

If you see the page with links to administration pages of each of the cores defined, that
means that your Solr is up and running.

posted @ 2013-05-11 12:08  纵酒挥刀斩人头  阅读(2096)  评论(5编辑  收藏  举报