我在嵌入式 Jetty 中运行 Solr 4.4.0 但我得到以下异常:
3859 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer - null:java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:433)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:543)
at org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:382)
at org.apache.solr.schema.FieldTypePluginLoader$3.create(FieldTypePluginLoader.java:376)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
at org.apache.solr.schema.FieldTypePluginLoader.readAnalyzer(FieldTypePluginLoader.java:400)
at org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:86)
at org.apache.solr.schema.FieldTypePluginLoader.create(FieldTypePluginLoader.java:43)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:467)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:164)
at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:619)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassCastException: class org.apache.lucene.analysis.ar.ArabicNormalizationFilterFactory
at java.lang.Class.asSubclass(Class.java:3046)
at org.apache.lucene.util.SPIClassIterator.next(SPIClassIterator.java:137)
at org.apache.lucene.analysis.util.AnalysisSPILoader.reload(AnalysisSPILoader.java:79)
at org.apache.lucene.analysis.util.AnalysisSPILoader.<init>(AnalysisSPILoader.java:60)
at org.apache.lucene.analysis.util.AnalysisSPILoader.<init>(AnalysisSPILoader.java:49)
at org.apache.lucene.analysis.util.TokenFilterFactory.<clinit>(TokenFilterFactory.java:31)
... 27 more
这是 Java 代码中的主要方法:
public static void main(String[] args) throws Exception
{
Server server = new Server(8083);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("C:\\Solr\\solr-4.4.0.war");
server.setHandler(webapp);
System.setProperty("solr.solr.home", "C:\\solr");
server.start();
server.join();
}
我们正在使用在 schema.xml 中声明的自定义字段类型,如下所示(它可以在没有此字段类型的情况下工作):
<fieldType name="zyfield" class="solr.TextField" positionIncrementGap="0" >
<analyzer type="index">
<!--<tokenizer class="solr.PatternTokenizerFactory" pattern="([\.0-9]+|@??[&'a-zA-Z_0-9-]+(\.(net|ie|uk|com|txt))?)" group="1"/>-->
<tokenizer class="solr.PatternTokenizerFactory" pattern="(www|@??[-0-9\p{L}\p{Sc}]+?[-'0-9.\p{L}\p{Sc}&]*[-0-9\p{L}]+?|[-0-9\p{L}\p{Sc}]+?)" group="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="ie.solrplugin.KDelimiterFilterFactory"/>
<filter class="ie.solrplugin.JunkTokenFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.PatternTokenizerFactory" pattern="(www|@??[-0-9\p{L}\p{Sc}]+?[-'0-9.\p{L}\p{Sc}&]*[-0-9\p{L}]+?|[-0-9\p{L}\p{Sc}]+?)" group="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="ie.solrplugin.KDelimiterFilterFactory"/>
<filter class="ie.solrplugin.JunkTokenFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
</analyzer>