Sorry, but there's too much here to debug remotely. I strongly advise you
back waaaay up. Undo (but save) all your changes. Start by doing
the simplest thing you can, just get a dummy class in place and
get it called. Perhaps create a really dumb logger method that
opens a text file, writes a message, and closes the file. Inefficient
I know, but this is just to find out the problem. Debugging by println is
an ancient technique...

Once you're certain the dummy class is called, gradually build it up
to the complex class you eventually want.

One problem here is that you've changed a bunch of moving parts, copied
jars around (it's unclear whether you have two copies of solr-core in your
classpath, for instance). So knowing exactly which one of those is the issue
is very difficult, especially since you may have forgotten one of the things
you did. I know when I've been trying to do something for days, lots of
details get lost.

Try to avoid changing the underlying Solr code, can you do what you want
by subclassing instead and calling your new class? That would avoid
a bunch of problems.  If you can't subclass, copy the whole thing and
rename it to something new and call *that* rather than re-use the
synonymfilterfactory. The only jar you should copy to the <lib> directory
would be the one you put your new class in.

I can't emphasize strongly enough that you'll save yourself lots of grief if
you start with a fresh install and build up gradually rather than try to
unravel the current code. It feels wasteful, but winds up being faster in
my experience...

Good Luck!
Erick

On Tue, Apr 26, 2011 at 12:41 AM, rajini maski <rajinima...@gmail.com> wrote:
> Thanks Erick. I have added my replies to the points you did mention. I am
> somewhere going wrong. I guess do I need to club both the jars or something
> ? If yes, how do i do that? I have no much idea about java and jar files.
> Please guide me here.
>
> A couple of things to try.
>
> 1> when you do a 'jar -tfv <yourjar>", you should see
> output like:
>  1183 Sun Jun 06 01:31:14 EDT 2010
> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
> and your <filter> statement may need the whole path, in this example...
> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
> this
> is just an example of the pathing, this class has nothing to do with
> your filter)...
>
> I could see this output..
>
> 2> But I'm guessing your path is actually OK, because I'd expect to be
> seeing a
> "class not found" error. So my guess is that your class depends on
> other jars that
> aren't packaged up in your jar and if you find which ones they are and copy
> them
> to your lib directory you'll be OK. Or your code is throwing an error
> on load. Or
> something like that...
>
> There is jar - "apache-solr-core-1.4.1.jar" this has the
> BaseTokenFilterFacotry class and the Synonymfilterfactory class..I made the
> changes in second class file and created it as new. Now i created a jar of
> that java file and placed this in solr home/lib and also placed
> "apache-solr-core-1.4.1.jar" file in lib folder of solr home.  [solr home -
> c:\orch\search\solr  lib path - c:\orch\search\solr\lib]
>
> 3> to try to understand what's up, I'd back up a step. Make a really
> stupid class
> that doesn't do anything except derive from BaseTokenFilterFacotry and see
> if
> you can load that. If you can, then your process is OK and you need to
> find out what classes your new filter depend on. If you still can't, then we
> can
> see what else we can come up with..
>
>
> I am perhaps doing same. In the synonymfilterfactory class, there is a
> function parse rules which takes delimiters as one of the input parameter.
> Here i changed  comma ',' to '~' tilde symbol and  thats it.
>
>
> Regards,
> Rajani
>
>
> On Mon, Apr 25, 2011 at 6:26 PM, Erick Erickson 
> <erickerick...@gmail.com>wrote:
>
>> Looking at things more carefully, it may be one of your dependent classes
>> that's not being found.
>>
>> A couple of things to try.
>>
>> 1> when you do a 'jar -tfv <yourjar>", you should see
>> output like:
>>  1183 Sun Jun 06 01:31:14 EDT 2010
>> org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizer.class
>> and your <filter> statement may need the whole path, in this example...
>> <filter class="org.apache.lucene.analysis.sinks.TokenTypeSink"..../> (note,
>> this
>> is just an example of the pathing, this class has nothing to do with
>> your filter)...
>>
>> 2> But I'm guessing your path is actually OK, because I'd expect to be
>> seeing a
>> "class not found" error. So my guess is that your class depends on
>> other jars that
>> aren't packaged up in your jar and if you find which ones they are and copy
>> them
>> to your lib directory you'll be OK. Or your code is throwing an error
>> on load. Or
>> something like that...
>>
>> 3> to try to understand what's up, I'd back up a step. Make a really
>> stupid class
>> that doesn't do anything except derive from BaseTokenFilterFacotry and see
>> if
>> you can load that. If you can, then your process is OK and you need to
>> find out what classes your new filter depend on. If you still can't, then
>> we can
>> see what else we can come up with..
>>
>> Best
>> Erick
>>
>> On Mon, Apr 25, 2011 at 2:34 AM, rajini maski <rajinima...@gmail.com>
>> wrote:
>> > Erick ,
>> > *
>> > *
>> > * Thanks.* It was actually a copy mistake. Anyways i did a redo of all
>> the
>> > below mentioned steps. I had given class name as
>> > <filter class="pointcross.orchSynonymFilterFactory"
>> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >
>> > I did it again now following few different steps following this link :
>> >
>> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-32.htm
>> >
>> >
>> > 1 ) Created new package in src folder .
>> *org.apache.pointcross.synonym*.This
>> > is having class Synonym.java
>> >
>> > 2) Now did a right click on same package and selected export option->Java
>> > tab->JAR File->Selected the path for package -> finish
>> >
>> > 3) This created jar file in specified location. Now followed in cmd  ,
>> jar
>> > tfv
>> > org.apache.pointcross.synonym. the following was desc in cmd.
>> >
>> > :\Apps\Rajani Eclipse\Solr141_jar>jar -
>> > tfv org.apache.pointcross.synonym.Synonym.jar
>> >  25 Mon Apr 25 11:32:12 GMT+05:30 2011 META-INF/MANIFEST.MF
>> >  383 Thu Apr 14 16:36:00 GMT+05:30 2011 .project
>> >  2261 Fri Apr 22 16:26:12 GMT+05:30 2011 .classpath
>> >  1017 Thu Apr 21 16:34:20 GMT+05:30 2011 jarLog.jardesc
>> >
>> > 4) Now placed same jar file in solr home/lib folder .Solrconfig.xml
>> >  enabled <lib dir="./lib" /> and in schema  <filter
>> class="synonym.Synonym"
>> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >
>> > 5) Restart tomcat : http://localhost:8097/finding1
>> >
>> > Error SEVERE: org.apache.solr.common.SolrException: Error loading class
>> > 'pointcross.synonym.Synonym'
>> > at
>> >
>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
>> > at
>> >
>> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
>> > at
>> >
>> org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:84)
>> > at
>> >
>> org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:141)
>> > at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:835)
>> > at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:58)
>> >
>> >
>> > I am basically trying to enable this jar functionality to solr. Please
>> let
>> > me know the mistake here.
>> >
>> > Rajani
>> >
>> >
>> >
>> >
>> > On Fri, Apr 22, 2011 at 6:29 PM, Erick Erickson <erickerick...@gmail.com
>> >wrote:
>> >
>> >> First I appreciate your writeup of the problem, it's very helpful when
>> >> people
>> >> take the time to put in the details....
>> >>
>> >> I can't reconcile these two things:
>> >>
>> >> {{{<filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> >> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >>
>> >> as org.apache.solr.common.SolrException: Error loading class
>> >> 'pointcross.orchSynonymFilterFactory' at}}}
>> >>
>> >> This seems to indicate that your config file is really looking for
>> >> "pointcross.orchSynonymFilterFactory" rather than
>> >> "org.apache....pco.search.orchSynonymFilterFactory".
>> >>
>> >> Do you perhaps have another definition in your config
>> >> "pointcross.orchSynonymFilterFactory"?
>> >>
>> >> Try running "jar -tfv <your jar file>" to see what classes
>> >> are actually defined in the file in the solr lib directory. Perhaps
>> >> it's not what you expect (Perhaps Eclipse did something
>> >> unexpected).
>> >>
>> >> Given the anomaly above (the error reported doesn't correspond to
>> >> the class you defined) I'd also look to see if you have any old
>> >> jars lying around that you somehow get to first.
>> >>
>> >> Finally, is there any chance that your
>> >> "pointcross.orchSynonymFilterFactory"
>> >> is a dependency of "org.apache....pco.search.orchSynonymFilterFactory"?
>> In
>> >> which case Solr may be finding
>> >> "org.apache....pco.search.orchSynonymFilterFactory"
>> >> but failing to load a dependency (that would have to be put in the lib
>> >> or the jar).
>> >>
>> >> Hope that helps
>> >> Erick
>> >>
>> >>
>> >>
>> >> On Fri, Apr 22, 2011 at 3:00 AM, rajini maski <rajinima...@gmail.com>
>> >> wrote:
>> >> > One doubt regarding adding the solr plugin.
>> >> >
>> >> >
>> >> >          I have a new java file created that includes few changes in
>> >> > SynonymFilterFactory.java. I want this java file to be added to solr
>> >> > instance.
>> >> >
>> >> > I created a package as : org.apache.pco.search
>> >> > This includes OrcSynonymFilterFactory java class extends
>> >> > BaseTokenFilterFactory implements ResourceLoaderAware {code.....}
>> >> >
>> >> > Packages included: import org.apache.solr.analysis.*;
>> >> >
>> >> > import org.apache.lucene.analysis.Token;
>> >> > import org.apache.lucene.analysis.TokenStream;
>> >> > import org.apache.solr.common.ResourceLoader;
>> >> > import org.apache.solr.common.util.StrUtils;
>> >> > import org.apache.solr.util.plugin.ResourceLoaderAware;
>> >> >
>> >> > import java.io.File;
>> >> > import java.io.IOException;
>> >> > import java.io.Reader;
>> >> > import java.io.StringReader;
>> >> > import java.util.ArrayList;
>> >> > import java.util.List;
>> >> >
>> >> >
>> >> >  I exported this java file in eclipse,
>> >> >  selecting  File tab-Export to package
>> >> > -org.apache.pco.search-OrchSynonymFilterFactory.java
>> >> >  and generated jar file - org.apache.pco.orchSynonymFilterFactory.jar
>> >> >
>> >> >  This jar file placed in /lib folder of solr home instance
>> >> >  Changes in solr config - <lib dir="./lib" />
>> >> >
>> >> >  Now i want to add this in schema fieldtype for synonym filter as
>> >> >
>> >> > <filter class="org.apache.pco.search.orchSynonymFilterFactory"
>> >> > synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>> >> >
>> >> > But i am not able to do it.." It has an error
>> >> > as org.apache.solr.common.SolrException: Error loading class
>> >> > 'pointcross.orchSynonymFilterFactory' at
>> >> >
>> >>
>> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:373)
>> >> > at
>> >> >
>> >>
>> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:388)
>> >> > at org.apache.solr.util.plugin.AbstractPluginLoader"
>> >> >
>> >> > Please can anyone tell me , What is the mistake i am doing here and
>> the
>> >> fix
>> >> > for it ?
>> >> >
>> >> > Rajani
>> >> >
>> >>
>> >
>>
>

Reply via email to