我正在运行Solr 3.4并想使用clusteringComponent。 遵循本教程:http://wiki.apache.org/solr/ClusteringComponent结合solrconfig.xml中的默认条目,我有以下配置@ solrconfig.xml
<searchComponent name="clustering"
enable="${solr.clustering.enabled:true}"
class="org.apache.solr.handler.clustering.ClusteringComponent" >
<!-- Declare an engine -->
<lst name="engine">
<str name="name">default</str>
<str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
<str name="LingoClusteringAlgorithm.desiredClusterCountBase">20</str>
</lst>
<lst name="engine">
<str name="name">stc</str>
<str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
</lst>
</searchComponent>
<requestHandler name="/cl" class="solr.SearchHandler" >
<lst name="defaults">
<str name="echoParams">explicit</str>
<bool name="clustering">true</bool>
<str name="clustering.engine">default</str>
<bool name="clustering.results">true</bool>
<!-- Fields to cluster on -->
<str name="carrot.title">UEBSCHRIFT</str>
<str name="carrot.snippet">TEXT</str>
</lst>
因此,如果我尝试使用requestHandler http://server:8080/solr/mycore/cl?q=*:*
,我会收到以下Java异常:
java.lang.NoClassDefFoundError: com.carrotsearch.hppc.ObjectContainer
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at org.carrot2.text.preprocessing.pipeline.BasicPreprocessingPipeline.<init>(BasicPreprocessingPipeline.java:106)
at org.carrot2.text.preprocessing.pipeline.CompletePreprocessingPipeline.<init>(CompletePreprocessingPipeline.java:32)
at org.carrot2.clustering.lingo.LingoClusteringAlgorithm.<init>(LingoClusteringAlgorithm.java:129)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1325)
at org.carrot2.util.pool.SoftUnboundedPool.borrowObject(SoftUnboundedPool.java:80)
at org.carrot2.core.PoolingProcessingComponentManager.prepare(PoolingProcessingComponentManager.java:128)
at org.carrot2.core.Controller.process(Controller.java:333)
at org.carrot2.core.Controller.process(Controller.java:240)
at org.apache.solr.handler.clustering.carrot2.CarrotClusteringEngine.cluster(CarrotClusteringEngine.java:136)
at org.apache.solr.handler.clustering.ClusteringComponent.process(ClusteringComponent.java:91)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:194)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:735)
Caused by: java.lang.ClassNotFoundException: com.carrotsearch.hppc.ObjectContainer
at java.lang.Throwable.<init>(Throwable.java:80)
at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:76)
at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:923)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 31 more
关键是,我不知道这意味着什么。我正在寻找几个小时而没有找到解决方案。
顺便说一下:我正在使用以下选项在tomcat上运行:
export CATALINA_OPTS="-Dsolr.clustering.enabled=true"
(Solr 3.4中仍然需要这样做吗?)
catalina选项是java命令的一部分,您可以使用ps -efa
/usr/lib64/jvm/java-1_6_0-ibm-1.6.0/jre//bin/java -Djava.util.logging.config.file = / opt / tomcat6 / conf / logging.properties -Xms2048m -Xmx2048m -Djava.util.logging.manager = org.apache.juli.ClassLoaderLogManager -Dsolr.clustering.enabled = true - Djava.endorsed.dirs = / opt / tomcat6 / endorsed -classpath /opt/tomcat6/bin/bootstrap.jar -Dcatalina.base = / opt / tomcat6 -Dcatalina.home = / opt / tomcat6 -Djava.io.tmpdir = / opt / tomcat6 / temp org.apache.catalina.startup.Bootstrap start
有谁知道我能做些什么来解决这个问题?
//更新: 如果我添加hppc-0.3.4-jdk15.jar,我会收到以下错误:
java.lang.NoClassDefFoundError: org.apache.mahout.math.matrix.DoubleMatrix2D
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at org.carrot2.clustering.lingo.LingoClusteringAlgorithm.<init>(LingoClusteringAlgorithm.java:134)
[...]
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.math.matrix.DoubleMatrix2D
at java.lang.Throwable.<init>(Throwable.java:80)
at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:76)
at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:923)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 29 more
看起来,我必须安装一个mahout存档,但我认为,所有用于群集的包都包含在Solr 3.4中?看起来,我的方向错了?!
答案 0 :(得分:2)
如果您将Solr与tomcat一起用作单独的实例,则需要复制jar以便它们可用于Solr。
注意:此Solr示例服务器引用了以外的某些Solr jar 此服务器目录用于包含语句的非核心模块 solrconfig.xml中。如果您复制此示例服务器并希望 使用ExtractingRequestHandler(SolrCell),DataImportHandler(DIH), 您可以使用UIMA,群集组件或“contrib”中的其他模块 将需要将所需的jar复制到solr / lib或更新路径 到solrconfig.xml中的jar。
检查solrconfig.xml中的群集和胡萝卜罐
可能你错过了hppc-0.3.4-jdk15.jar
答案 1 :(得分:0)
您是否添加了Mahout Math软件包?
它似乎是一个单独的包。
NoClassDefFoundError: org.apache.mahout.math.matrix.DoubleMatrix2D
^^^^^^^^^^^^^^^^^^^^^^
答案 2 :(得分:0)
为什么不使用Solr的默认包装(这是官方支持的)?它附带了Jetty,可以节省与classpath相关的麻烦,因为已经配置好了。
回答你的问题,你需要Solr的默认群集扩展文件夹中的所有JAR;对于4.0 alpha,这将是:contrib / clustering / lib / * .jar
carrot2核-3.5.0.jar HPPC-0.3.3.jar 杰克逊核心ASL-1.7.4.jar 杰克逊映射器-ASL-1.7.4.jar 象夫的集合-0.3.jar 象夫 - 数学0.3.jar 简单的XML-2.4.1.jar
答案 3 :(得分:0)
使用solR 4将此文件复制到文件夹conf
中http://svn.apache.org/repos/asf/labs/alike/trunk/demo/solrhome/collection1/conf/solrconfig.xml