<lib dir="../../contrib/extraction/lib" />
<!-- When a regex is specified in addition to a directory, only the
files in that directory which completely match the regex
(anchored on both ends) will be included.
-->
<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
<lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
<!-- If a dir option (with or without a regex) is used and nothing
is found that matches, it will be ignored
-->
<lib dir="../../contrib/clustering/lib/" />
仔细分析这段xml代码,会发现在jetty中测试时,是可以找到那些对应的jar包,但是我是直接复制的conf和data目录到tomcat中solr目录下的,没做任何修改,于是就会出现找不到jar。想到这里,于是就把contrib和dist目录拷贝到tomcat中的solr目录下,然后修改其配置文件solrconfig.xml为:
<lib dir="contrib/extraction/lib" />
<!-- When a regex is specified in addition to a directory, only the
files in that directory which completely match the regex
(anchored on both ends) will be included.
-->
<lib dir="dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="dist/" regex="apache-solr-clustering-\d.*\.jar" />
<lib dir="dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
<!-- If a dir option (with or without a regex) is used and nothing
is found that matches, it will be ignored
-->
<lib dir="contrib/clustering/lib/" />
注意,这些目录的起始位置是solr.solr.home。
在这样修改以后,再次运行测试程序,一切ok。
备注:测试的代码来自于:http://wiki.apache.org/solr/ExtractingRequestHandler
测试的文档为solr中docs目录下的tutorial.html文件
最后在地址栏中输入:http://localhost:8080/solr/select?q=attr_content:tutorial 即可看到结果