Shawn,

Thanks for the response! Yes, that was it, an older version unexpectedly in the 
classpath.

And for the benefit of anyone who searches the list archive with a similar 
debugging need, it's pretty easy to print out the classpath from ant's 
build.xml:

  <path id="classpath">
    <pathelement location="${builddir}/common"/>
    <fileset dir="${builddir}/deps/"><include name="**/*.jar"/></fileset>
    <fileset dir="libs"><include name="**/*.jar"/></fileset>
    <fileset erroronmissingdir="false" dir="${solr.dir}"><include 
name="**/*.jar"/></fileset>
    <fileset erroronmissingdir="false" 
dir="${vufind.dir}/solr/vendor/dist"><include name="**/*.jar"/></fileset>
    <fileset erroronmissingdir="false" 
dir="${vufind.dir}/solr/vendor/server/solr-webapp/webapp/WEB-INF/lib"><include 
name="**/*.jar"/></fileset>
  </path>
  <!-- Can be useful for debugging -->
  <pathconvert property="classpathProp" refid="classpath"/>
  <echo>Classpath: ${classpathProp}</echo>


-Tod

On Nov 29, 2017, at 6:00 PM, Shawn Heisey 
<apa...@elyograg.org<mailto:apa...@elyograg.org>> wrote:

On 11/29/2017 2:27 PM, Tod Olson wrote:
I'm modifying a existing custom request handler for an open source project, and 
am looking for some help with a compile error around an anonymous 
SimpleCollector. The build failure message from ant and the source of the 
specific method are below. I am compiling on a Mac with Java 1.8 and Solr 
6.4.2. There are two things I do not understand.

First:
   [javac] 
/Users/tod/src/vufind-browse-handler/browse-handler/java/org/vufind/solr/handler/BrowseRequestHandler.java:445:
 error: <anonymous org.vufind.solr.handler.BibDB$1> is not abstract and does 
not override abstract method setNextReader(AtomicReaderContext) in Collector
   [javac]         db.search(q, new SimpleCollector() {

Based on the javadoc, neither SimpleCollector nor Collector define a 
setNextReader(AtomicReaderContext) method. Grepping through the Lucene 6.4.2 
source reveals neither a setNextReader method (though maybe a couple archaic 
comments), nor an AtomicReaderContext class or interface.

<snip>

Second:
   [javac]     method IndexSearcher.search(Query,Collector) is not applicable
   [javac]       (argument mismatch; <anonymous SimpleCollector> cannot be 
converted to Collector)

How is it that SimpleCollector cannot be converted to Collector? Perhaps this 
is just a consequence of the first error.

For the first error:  What version of Solr/Lucene are you compiling
against?  I have found that Collector *did* have a setNextReader method
up through Lucene 4.10.4, but in 5.0, that method was gone.  I suspect
that what's causing your first problem is that you have older Lucene
jars (4.x or earlier) on your classpath, in addition to a newer version
that you actually want to use for the compile.

I think that can also explain the second problem.  It looks like
SimpleCollector didn't exist in Lucene 4.10, which is the last version
where Collector had setNextReader.  SimpleCollector is mentioned in the
javadoc for Collector as of 5.0, though.

Thanks,
Shawn



Reply via email to