在Windows 8上使用apache tomcat 7设置solr多核问题

时间:2013-10-15 06:43:56

标签: solr tomcat7 apache-zookeeper solrcloud

我尝试使用solr上的apache tomcat 7windows 8中进行多核设置。 solr home打开,但没有核心出现。我检查了日志记录部分,出现以下错误:

 org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error Instantiating SearchComponent, solr.clustering.ClusteringComponent failed to instantiate org.apache.solr.handler.component.SearchComponent

当我尝试添加collection1(默认核心)时,这是堆栈跟踪:

SolrCore 'collection1' is not available due to init failure: Error loading class 'solr.clustering.ClusteringComponent',trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error loading class 'solr.clustering.ClusteringComponent' at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:785) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:295) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:195) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.clustering.ClusteringComponent' at org.apache.solr.core.SolrCore.<init>(SolrCore.java:834) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:625) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:524) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:559) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:241) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) ... 3 more Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.clustering.ClusteringComponent' at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:449) at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:381) at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:526) at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:582) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2128) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2122) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2155) at org.apache.solr.core.SolrCore.loadSearchComponents(SolrCore.java:1177) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:762) ... 11 more Caused by: java.lang.ClassNotFoundException: solr.clustering.ClusteringComponent at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.net.FactoryURLClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:433) ... 19 more ,code=500}

我已经在stackoverflow中引用了Tomcat SOLR multiple cores setup,但没有任何帮助。另外,浏览了帖子中给出的博客链接但又没有用了。

堆栈跟踪如下:

org.apache.solr.common.SolrException: Error Instantiating SearchComponent, solr.clustering.ClusteringComponent failed to instantiate org.apache.solr.handler.component.SearchComponent
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:834)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:625)
    at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:524)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:559)
    at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:249)
    at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:241)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(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)
Caused by: org.apache.solr.common.SolrException: Error Instantiating SearchComponent, solr.clustering.ClusteringComponent failed to instantiate org.apache.solr.handler.component.SearchComponent
    at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:547)
    at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:582)
    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2128)
    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2122)
    at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:2155)
    at org.apache.solr.core.SolrCore.loadSearchComponents(SolrCore.java:1177)
    at org.apache.solr.core.SolrCore.<init>(SolrCore.java:762)
    ... 11 more
Caused by: java.lang.ClassCastException: class org.apache.solr.handler.clustering.ClusteringComponent
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:443)
    at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:381)
    at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:526)

这是我的Solr.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<!--
 All (relative) paths are relative to the installation path

  persistent: Save changes made via the API to this file
  sharedLib: path to a lib directory that will be shared across all cores
-->
<solr persistent="true">

  <!--
  adminPath: RequestHandler path to manage cores.  
    If 'null' (or absent), cores will not be manageable via request handler
  -->
  <cores adminPath="/admin/cores">
    <core name="core0" instanceDir="core0"/>
    <core name="core1" instanceDir="core1"/>
    <!--<core name="collection1" instanceDir="collection1"/>-->
  </cores> 
</solr>

更新了问题:    的 solrconfig.xml中

<lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/contrib/extraction/lib" regex=".*\.jar" />
 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/dist/" regex="solr-cell-\d.*\.jar" />

 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/contrib/clustering/lib/" regex=".*\.jar" />
 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/dist/" regex="solr-clustering-\d.*\.jar" />

 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/contrib/langid/lib/" regex=".*\.jar" />
 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/dist/" regex="solr-langid-\d.*\.jar" />

 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/contrib/velocity/lib" regex=".*\.jar" />
 <lib dir="C:/Users/admin/Desktop/solr/solr-4.5.0/solr-4.5.0/dist/" regex="solr-velocity-\d.*\.jar" />

2 个答案:

答案 0 :(得分:0)

ClusteringComponent是对SOLR的贡献,而不是核心组件。 因此,您需要在类路径的某处添加其二进制文件/依赖项。 最简单的方法是在solrconfig.xml中定义它 - 你可以专门指向目录/ jar等。

答案 1 :(得分:0)

您确定要指向右侧的collection1文件夹,其中包含conf solrconfig.xml,其中为lib添加了一些修改吗?

你在web.xml(solr.war)的关键“solr / home”中放了什么? 该值必须是solr home的目录,就在这个目录下你必须有bin和collection1目录......包含文件solorconfig.xml的那个..

<env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>\solr_home</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
</env-entry>