Problem is resolved now .

Thanks a lot Erick .!  :)

Will catch you  in next problem soon  :)  . You have saved a lot of time
for me .


On Thu, Nov 9, 2017 at 2:06 AM, Erick Erickson <erickerick...@gmail.com>
wrote:

> Why are you extending TokenizerFactory? What you have is a filter
> factory which should extend TokenFilterFactory and optionally be
> MultiTermAware. I'd use LowerCaseFitlerFactory as a model. Tokenizers
> break up the incoming stream, filters do something with the tokens
> emitted by the tokenizer.
>
> On Wed, Nov 8, 2017 at 9:43 AM, kumar gaurav <kg2...@gmail.com> wrote:
> > Very much thanks for reply Erick !
> >
> > Now ClassCastException is gone . It have corrected my fault .
> >
> > So I am loading plugin correctly because is not giving me no class found
> > exception
> >
> > in solrconfig.xml
> >
> > <lib dir="${solr.install.dir:../../../..}/lib/myproject/lib"
> > regex=".*\.jar" />
> >
> > in managed-schema
> > <fieldType name="text_reversed" class="solr.TextField">
> >       <analyzer>
> >         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
> >         <tokenizer class="com.skyrim.ReverseFilterFactory" />
> >       </analyzer>
> >     </fieldType>
> >
> > Now I am facing new error that is following :
> >
> > Caused by: org.apache.solr.common.SolrException: Error instantiating
> > class: 'com.skyrim.ReverseFilterFactory'
> >         at org.apache.solr.core.SolrResourceLoader.newInstance(
> SolrResourceLoader.java:578)
> >         at org.apache.solr.schema.FieldTypePluginLoader$2.
> create(FieldTypePluginLoader.java:343)
> >         at org.apache.solr.schema.FieldTypePluginLoader$2.
> create(FieldTypePluginLoader.java:336)
> >         at org.apache.solr.util.plugin.AbstractPluginLoader.load(
> AbstractPluginLoader.java:152)
> >         ... 20 more
> > Caused by: java.lang.NoSuchMethodException:
> > com.skyrim.ReverseFilterFactory.<init>(java.util.Map)
> >         at java.lang.Class.getConstructor0(Class.java:3082)
> >         at java.lang.Class.getConstructor(Class.java:1825)
> >         at org.apache.solr.core.SolrResourceLoader.newInstance(
> SolrResourceLoader.java:569)
> >
> >
> >
> > I am waiting for your reply ..
> >
> >
> >
> > On Wed, Nov 8, 2017 at 8:24 PM, Erick Erickson <erickerick...@gmail.com>
> > wrote:
> >
> >> OK, if you're compiling and running against the same versions, then
> >> that error means that you haven't set your paths correctly so Solr can
> >> find your custom jar. In solrconfig.xml you should add a <lib...>
> >> directive that points to your custom jar file.
> >>
> >> I usually start by using an absolute path here until I get the jar
> >> loading properly. At that point you can (and should) move it to a
> >> relative path. I use the absolute path to start since setting the
> >> relative path can be tricky.
> >>
> >> Best,
> >> Erick
> >>
> >> On Tue, Nov 7, 2017 at 10:59 PM, kumar gaurav <kg2...@gmail.com> wrote:
> >> > Hi Erick
> >> >
> >> > I am very happy to see your reply .
> >> >
> >> > It was mistakenly written 5.4.1 in last mail . I am developing plugin
> in
> >> > solr-5.2.1 .
> >> >
> >> > i am compiling jars and executing for the same version i.e. 5.2.1 ,
> yet i
> >> > am getting following error
> >> >
> >> > Caused by: org.apache.solr.common.SolrException: Plugin init failure
> >> > for [schema.xml] analyzer/filter: class
> >> > com.skyrim.ReverseFilterFactory
> >> >         at org.apache.solr.util.plugin.AbstractPluginLoader.load(
> >> AbstractPluginLoader.java:178)
> >> >         at org.apache.solr.schema.FieldTypePluginLoader.readAnalyzer(
> >> FieldTypePluginLoader.java:401)
> >> >         at org.apache.solr.schema.FieldTypePluginLoader.create(
> >> FieldTypePluginLoader.java:104)
> >> >         at org.apache.solr.schema.FieldTypePluginLoader.create(
> >> FieldTypePluginLoader.java:52)
> >> >         at org.apache.solr.util.plugin.AbstractPluginLoader.load(
> >> AbstractPluginLoader.java:152)
> >> >         ... 16 more
> >> > Caused by: java.lang.ClassCastException: class com.skyrim.
> >> ReverseFilterFactory
> >> >         at java.lang.Class.asSubclass(Class.java:3404)
> >> >         at org.apache.solr.core.SolrResourceLoader.findClass(
> >> SolrResourceLoader.java:475)
> >> >         at org.apache.solr.core.SolrResourceLoader.newInstance(
> >> SolrResourceLoader.java:560)
> >> >         at org.apache.solr.schema.FieldTypePluginLoader$3.
> >> create(FieldTypePluginLoader.java:383)
> >> >         at org.apache.solr.schema.FieldTypePluginLoader$3.
> >> create(FieldTypePluginLoader.java:377)
> >> >         at org.apache.solr.util.plugin.AbstractPluginLoader.load(
> >> AbstractPluginLoader.java:152)
> >> >
> >> >
> >> >
> >> > Please help me its very urgent to build a custom tokenizer like
> >> > StandardTokenizerFactory where i will write my own rules for indexing.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > On Wed, Nov 8, 2017 at 4:30 AM, Erick Erickson <
> erickerick...@gmail.com>
> >> > wrote:
> >> >
> >> >> Looks to me like you're compiling against the jars from one version
> of
> >> >> Solr and executing against another.
> >> >>
> >> >> /root/solr-5.2.1/server/solr/#####/conf/managed-schema
> >> >>
> >> >> yet you claim to be using 5.4.1
> >> >>
> >> >> On Tue, Nov 7, 2017 at 12:00 PM, kumar gaurav <kg2...@gmail.com>
> wrote:
> >> >> > Hi
> >> >> >
> >> >> > I am developing my own custom filter in solr 5.4.1.
> >> >> >
> >> >> > I have created a jar of a filter class with extend to
> TokenizerFactory
> >> >> > class .
> >> >> >
> >> >> > When i loaded in to sol config and add my filter to managed-schema
> , i
> >> >> > found following error -
> >> >> >
> >> >> > org.apache.solr.common.SolrException: Could not load conf for core
> >> >> > ####: Plugin init failure for [schema.xml] fieldType
> "text_reversed":
> >> >> > Plugin init failure for [schema.xml] analyzer/filter: class
> >> >> > com.skyrim.ReverseFilterFactory. Schema file is
> >> >> > /root/solr-5.2.1/server/solr/#####/conf/managed-schema
> >> >> >
> >> >> >
> >> >> > Caused by: java.lang.ClassCastException: class com.skyrim.
> >> >> ReverseFilterFactory
> >> >> >
> >> >> >
> >> >> > Why java.lang.ClassCastException is occurring while loading a
> plugin ?
> >> >> >
> >> >> >
> >> >> > Please help someone . very much thanks in advance .
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > regards
> >> >> >
> >> >> > Kumar Gaurav
> >> >> >
> >> >> > Software Engineer
> >> >>
> >>
>

Reply via email to