Hi all,

I’m in a bit of a cul de sac with an issue, hope you can help.

I am creating a custom UpdateRequestProcessor. The Solr documentation details 
that I need to write a factory class subclassing UpdateRequestProcessorFactory 
and this should return an instance of my class that subclasses 
UpdateRequestProcessor.

I have done this, and I have created a JAR.

I have deployed the JAR into Tomcat’s lib folder where Solr is running.

I have modified the solrconfig to include my class correctly.

On startup Solr finds my class but does not believe it conforms to being a 
UpdateRequestProcessorFactory.

SEVERE: org.apache.solr.common.SolrException: Error Instantiating 
UpdateRequestProcessorFactory, 
com.acme.solr.update.processor.URLRewriteUpdateRequestProcessorFactory is not a 
org.apache.solr.update.processor.UpdateRequestProcessorFactory
        at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:421)

Things I have tried:

- Ensured that I am compiling my JAR with the exact JDK that is running Solr.
- Downloaded Solr 3.6.2 and copied one of the Solr built-in processors, renamed 
it, compiled it and tried to use it - SAME issue.
- Created a test that uses the same code as the Solr code that is failing 
(namely, isAssignableFrom):

            Class clazz = 
Class.forName("com.acme.solr.update.processor.URLRewriteUpdateRequestProcessorFactory");
            boolean isA = 
UpdateRequestProcessorFactory.class.isAssignableFrom(clazz);
            System.out.println(isA);

Print’s “true” - i.e. it’s perfectly OK!

I include my simple processor here:

package com.acme.solr.update.processor;

public class URLRewriteUpdateRequestProcessorFactory extends 
UpdateRequestProcessorFactory
{
    @Override
    public UpdateRequestProcessor getInstance(SolrQueryRequest req, 
SolrQueryResponse rsp, UpdateRequestProcessor next) {
        return new URLRewriteProcessor(next);
    }
}

class URLRewriteProcessor extends UpdateRequestProcessor
{
    public URLRewriteProcessor(UpdateRequestProcessor next)
    {
        super(next);
    }

    @Override
    public void processAdd(AddUpdateCommand cmd) throws IOException
    {
        SolrInputDocument doc = cmd.getSolrInputDocument();
        doc.setField("foo", "bar");

        super.processAdd(cmd);
    }
}

At this point I am at a loss and would appreciate any assistance or ideas to 
try.

Cheers

Reply via email to