如何在 Tomcat 本地运行 Solr 4? [英] How to run Solr 4 in Tomcat locally?

查看:23
本文介绍了如何在 Tomcat 本地运行 Solr 4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在我的家用 PC(在 Tomcat 7 中)上设置 Solr 4.3,但它没有运行.我已经设置了 Tomcat 并部署了 solr.war 文件,该文件解压并显示在 Tomcat 的 Tomcat Web Apps Manager 屏幕中,但它没有运行,单击开始按钮没有任何作用(如它首先应该已经在运行).

这是我在 Tomcat 中的 solr.xml 上下文文件,它还提供了 solr.war 文件的路径以及我的 solr 核心所在的位置(这是默认的 Collection1):

<Context path="/solr" docBase="C:/LocalApps/Tomcat/apache-tomcat-7.0.40/webapps/solr.war" debug="0" crossContext="true"><环境名称="solr/home" type="java.lang.String" value="C:/LocalApps/Solr/solr-4.3.0/example/solr/" override="true"/>

这是tomcat的错误日志:

信息:启动 Servlet 引擎:Apache Tomcat/7.0.402013 年 6 月 9 日下午 11:04:07 org.apache.catalina.startup.HostConfig deployDescriptor信息:部署配置描述符 C:\LocalApps\Tomcat\apache-tomcat-7.0.40\conf\Catalina\localhost\solr.xml2013 年 6 月 9 日下午 11:04:07 org.apache.catalina.startup.HostConfig deployDescriptor警告:主机 appBase 内的 docBase C:\LocalApps\Tomcat\apache-tomcat-7.0.40\webapps\solr.war 已指定,将被忽略2013 年 6 月 9 日晚上 11:04:07 org.apache.catalina.startup.SetContextPropertiesRule 开始警告:[SetContextPropertiesRule]{Context} 将属性debug"设置为0"未找到匹配的属性.2013 年 6 月 9 日晚上 11:04:09 org.apache.catalina.core.StandardContext startInternal严重:错误 filterStart2013 年 6 月 9 日晚上 11:04:09 org.apache.catalina.core.StandardContext startInternal严重:由于先前的错误,上下文 [/solr] 启动失败

解决方案

您需要按照说明安装用于日志记录的 jars 此处.

只需将所有提到的文件复制到您的 tomcat/lib 目录中.并重启Tomcat.

<块引用>

  1. solr/example/lib/ext 中的 jars 复制到容器的主 lib 目录中.这些 jars 将设置 SLF4Jlog4j.正是这个 lib 目录高度可变的地方.对于 Debian 或使用操作系统供应商提供的 Tomcat 包的 Ubuntu 服务器,这可能是 /usr/share/tomcat6/lib/usr/share/tomcat7/lib.
  2. 将日志配置从 solr/example/resources/log4j.properties 复制到类路径.通常您可以使用与 jar 文件相同的位置以上.编辑首选日志目标的配置文件.
  3. 可选,如果您没有将 log4j.properties 放在类路径上,请设置 java 选项-Dlog4j.configuration=file:///path/to/log4j.properties

I've been trying to set up Solr 4.3 on my home PC (in Tomcat 7) but it doesn't run. I have set up Tomcat and deployed the solr.war file which both unpacks and shows up in the Tomcat Web Apps Manager screen in Tomcat but its not running and clicking the start button doesn't do anything (as it should already be running in the first place).

Here is my solr.xml context file in Tomcat which also gives the path to the solr.war file and where my solr Cores are (which is the default Collection1):

<Context path="/solr" docBase="C:/LocalApps/Tomcat/apache-tomcat-7.0.40/webapps/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="C:/LocalApps/Solr/solr-4.3.0/example/solr/" override="true"/>
</Context>

this is the error log in tomcat:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
Jun 09, 2013 11:04:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\LocalApps\Tomcat\apache-tomcat-7.0.40\conf\Catalina\localhost\solr.xml
Jun 09, 2013 11:04:07 PM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase C:\LocalApps\Tomcat\apache-tomcat-7.0.40\webapps\solr.war inside the host appBase has been specified, and will be ignored
Jun 09, 2013 11:04:07 PM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'debug' to '0' did not find a matching property.
Jun 09, 2013 11:04:09 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Jun 09, 2013 11:04:09 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/solr] startup failed due to previous errors

解决方案

You need to install the jars for logging as explained here.

Just copy all the mentioned files into your tomcat/lib dir. And restart Tomcat.

  1. Copy the jars from solr/example/lib/ext into your container's main lib directory. These jars will set up SLF4J and log4j. Exactly where this lib directory is highly variable. For a Debian or Ubuntu server using the Tomcat package available from the OS vendor, this is likely to be /usr/share/tomcat6/lib or /usr/share/tomcat7/lib.
  2. Copy the logging config from solr/example/resources/log4j.properties into a location on the classpath. Usually you can use the same location as the jar files above. Edit the configuration file for your preferred log destination.
  3. Optionally, if you did not place log4j.properties on the classpath, set java option -Dlog4j.configuration=file:///path/to/log4j.properties

这篇关于如何在 Tomcat 本地运行 Solr 4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆