我无法让 solr dataimportscheduler 工作。我有最新的 jar 文件,它打包了所有需要的类文件。尝试启动tomcat时出现以下错误。
Jun 21, 2012 11:36:06 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.apache.solr.handler.dataimport.scheduler.ApplicationListener
java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.scheduler.ApplicationListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:124)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4715)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Jun 21, 2012 11:36:06 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
我假设当他们说“不要忘记将以下侦听器声明添加到 Solr 的 web.xml:
<listener>
<listener-class>org.apache.solr.handler.dataimport.scheduler.ApplicationListener</listener-class>
</listener>
这意味着将下面的行添加到 Tomcat 的 web.xml
<listener>
<listener-class>org.apache.solr.handler.dataimport.scheduler.ApplicationListener</listener-class>
</listener>
任何帮助都感激不尽。
谢谢
更新:
我更新了 solr 的 web.xml,现在 tomcat 启动时没有任何错误,但是当计划任务运行时,它会清空我的索引。我有不止一个 solr 核心......我已经将 dataimport.properties 放在根文件夹中,每个核心都有一个。这就是我在根目录中的属性文件的样子。
#################################################
# #
# dataimport scheduler properties #
# #
#################################################
syncEnabled=1
syncCores=Internal.Locations #(Locations is a folder inside Internal)
server=localhost
port=8080
webapp=solr
params=/select?qt=/dataimport&command=delta-import&clean=false&commit=true
interval=10