Solr not loading a custom filter
I have written a custom KeepWord filter factory and have put the resultant jar under solr/lib directory. But when starting solr I am getting this error
SEVERE: org.apache.solr.common.SolrException: Error loading class 'org.custom.solr.analysis.MyKeepWordFilterFactory'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:404)
at org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:83)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:941)
at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:62)
at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:450)
at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:435)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:140)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:480)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:461)
at org.apache.solr.core.CoreContainer.load(CoreContainer.java:316)
...
Caused by: java.lang.ClassNotFoundException: org.custom.solr.analysis.MyKeepWordFilterFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
...
This is the content of my solr instance directory.
>$ ls solr/*
solr/README.txt
solr/conf:
admin-extra.html mapping-ISOLatin1Accent.txt scripts.conf stopwords.txt velocity/ elevate.xml protwords.txt solrconfig.xml stopwords_en.txt xslt/ mapping-FoldToASCII.txt schema.xml spellings.txt synonyms.txt
solr/data:
index/ spellchecker/
solr/lib:
my-solr-analyserfilter.jar
The content of the jar file
>$ unzip -l solr/lib/my-solr-analyserfilter.jar
Archive: solr/lib/ctown-solr-analyserfilter.jar
Length Date Time Name
-------- ---- ---- ----
0 09-23-11 23:07 META-INF/
60 09-23-11 23:07 META-INF/MANIFEST.MF
3330 09-23-11 23:07 org/custom/analysis/MyKeepWordFilterFactory.class
-------- -------
3390 3 files
I am using solr version 3.4.0. As per documentation - https://wiki.apache.org/solr/SolrPlugins#How_to_Load_Plugins - keeping the jar file under lib directory sho开发者_开发百科uld have made solr detect the jar. But apparently it's not happening. What am I doing wrong? Kindly help me in resolving this issue.
Couple of things -
1. org.custom.solr.analysis.MyKeepWordFilterFactory does not match the contents of your jar file org/custom/analysis/MyKeepWordFilterFactory.class. The solr package is missing.
2. If it still does not find it. Check if the entry in solrconfig.xml is uncommented and the jar file is loaded when the server starts up.
精彩评论