As it turns out, this didn't resolve my problem, but actually broke
the other part of the application that was using Lucene.

The error is as follows:

Caused by: java.lang.NoSuchMethodError:
org.apache.lucene.search.IndexSearcher.search(Lorg/apache/lucene/search/Query;)Lorg/apache/lucene/search/Hits;

In a previous message to this list, it was said that the Hits class,
which causes the NoSuchMethod error, was copied into the index-core
artifact, so it should be compatible with Lucene 3.0. Is there a way
to make sure that the VM resolves to the included version of Hits
rather than looking for it in the Lucene library where it no longer
exists?

So far the only solutions I've seen are to revert to Lucene 2.9.2,
which unfortunately I don't have the flexibility to do. Is there
another way to deal with this? I'd rather not have to edit the
indexing component and build from source, but it seems like it might
come to this.

Thanks,
Alex

On Fri, Aug 6, 2010 at 12:52 PM, Alex D'Amour <adam...@iq.harvard.edu> wrote:
> For future reference, if anybody else is in the situation I was in,
> once solution is to package up your library with dependency classes
> rolled up into the jar file.
>
> The following added to the POM.xml under plugins accomplishes this:
>
>        <plugin>
>            <artifactId>maven-assembly-plugin</artifactId>
>            <executions>
>              <execution>
>                <phase>package</phase>
>                <goals>
>                  <goal>attached</goal>
>                </goals>
>              </execution>
>            </executions>
>            <configuration>
>              <descriptorRefs>
>                <descriptorRef>jar-with-dependencies</descriptorRef>
>              </descriptorRefs>
>            </configuration>
>        </plugin>
>
>
> Alex
>
> On Thu, Aug 5, 2010 at 8:25 PM, Alex D'Amour <adam...@iq.harvard.edu> wrote:
>> Hi all,
>>
>> I'm getting this same error in an environment where a class I
>> implemented using Neo4j and the LuceneIndexService is called by an
>> application that's using Lucene 3.0. The application server is
>> unfortunately above my abstraction layer (I'm just implementing the
>> back end in neo4j), so I can't change the version of lucene that it's
>> including. Previous messages have suggested that the indexing
>> component should work using Lucene 3.0, but is there an easy way for
>> me to remvoe this version conflict without manually editing the
>> pom.xml in the indexing component source?
>>
>> Thanks,
>> Alex
>>
>> On Mon, Aug 2, 2010 at 11:07 AM, Peter Neubauer
>> <peter.neuba...@neotechnology.com> wrote:
>>> Max,
>>> since you are using neo4j-index, you should not be importing Lucene
>>> again, since it already is a dependency of the index components (and I
>>> think the version is higher there).
>>>
>>> So, upgrading to 1.1 and removing the Lucene dependency should fix it:
>>>
>>> <dependency>
>>>     <groupId>org.neo4j</groupId>
>>>     <artifactId>neo4j-kernel</artifactId>
>>>     <version>1.1</version>
>>>   </dependency>
>>>   <dependency>
>>>     <groupId>org.neo4j</groupId>
>>>     <artifactId>neo4j-index</artifactId>
>>>     <version>1.1</version>
>>>   </dependency>
>>>
>>> Cheers,
>>>
>>> /peter neubauer
>>>
>>> COO and Sales, Neo Technology
>>>
>>> GTalk:      neubauer.peter
>>> Skype       peter.neubauer
>>> Phone       +46 704 106975
>>> LinkedIn   http://www.linkedin.com/in/neubauer
>>> Twitter      http://twitter.com/peterneubauer
>>>
>>> http://www.neo4j.org               - Your high performance graph database.
>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>
>>>
>>>
>>> On Mon, Aug 2, 2010 at 3:11 PM, Max Jakob <max.ja...@fu-berlin.de> wrote:
>>>> Hi Peter,
>>>>
>>>>> this sounds like a version clash on Lucene. Can you check what
>>>>> version(s) of Lucene (and Neo4j-Index) you are running in the two
>>>>> scenarios?
>>>>
>>>> That would make sense to me as well. But like I said, on the first
>>>> run, the method is found. Running the exact same code a second time,
>>>> without any changes, it complains that the method is not found. (?!)
>>>>
>>>> Here the versions I use (for both runs) from my pom.xml:
>>>>    <dependency>
>>>>      <groupId>org.neo4j</groupId>
>>>>      <artifactId>neo4j-kernel</artifactId>
>>>>      <version>1.1-SNAPSHOT</version>
>>>>    </dependency>
>>>>    <dependency>
>>>>      <groupId>org.neo4j</groupId>
>>>>      <artifactId>neo4j-index</artifactId>
>>>>      <version>1.1-SNAPSHOT</version>
>>>>    </dependency>
>>>>    <dependency>
>>>>      <groupId>org.apache.lucene</groupId>
>>>>      <artifactId>lucene-highlighter</artifactId>
>>>>      <version>2.9.1</version>
>>>>    </dependency>
>>>>
>>>> Cheers,
>>>> Max
>>>>
>>>>
>>>> On Mon, Aug 2, 2010 at 3:01 PM, Peter Neubauer
>>>> <peter.neuba...@neotechnology.com> wrote:
>>>>> Max,
>>>>> this sounds like a version clash on Lucene. Can you check what
>>>>> version(s) of Lucene (and Neo4j-Index) you are running in the two
>>>>> scenarios?
>>>>>
>>>>> Cheers,
>>>>>
>>>>> /peter neubauer
>>>>>
>>>>> COO and Sales, Neo Technology
>>>>>
>>>>> GTalk:      neubauer.peter
>>>>> Skype       peter.neubauer
>>>>> Phone       +46 704 106975
>>>>> LinkedIn   http://www.linkedin.com/in/neubauer
>>>>> Twitter      http://twitter.com/peterneubauer
>>>>>
>>>>> http://www.neo4j.org               - Your high performance graph database.
>>>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Aug 2, 2010 at 2:38 PM, Max Jakob <max.ja...@fu-berlin.de> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I have a problem with the LuceneIndexService. When I create an indexed
>>>>>> graph base and I commit it to disk, next time I want to use it, I get
>>>>>> a NoSuchMethodError for LuceneIndexService.getSingleNode:
>>>>>>
>>>>>> Exception in thread "main" java.lang.NoSuchMethodError:
>>>>>> org.apache.lucene.search.IndexSearcher.search(Lorg/apache/lucene/search/Query;)Lorg/apache/lucene/search/Hits;
>>>>>>        at 
>>>>>> org.neo4j.index.lucene.LuceneIndexService.searchForNodes(LuceneIndexService.java:430)
>>>>>>        at 
>>>>>> org.neo4j.index.lucene.LuceneIndexService.getNodes(LuceneIndexService.java:310)
>>>>>>        at 
>>>>>> org.neo4j.index.lucene.LuceneIndexService.getSingleNode(LuceneIndexService.java:469)
>>>>>>        at 
>>>>>> org.neo4j.index.lucene.LuceneIndexService.getSingleNode(LuceneIndexService.java:461)
>>>>>>
>>>>>> To illustrate this in more detail: if I run the code below for the
>>>>>> first time, everything goes fine. On a second run I get the exception.
>>>>>> Could somebody give me a hint where I'm going wrong? (re-indexing does
>>>>>> not work) Do I have to initialize the LuceneIndexService differently
>>>>>> if the index is already on disk?
>>>>>>
>>>>>> Thanks in advance for any advice you have,
>>>>>> Max
>>>>>>
>>>>>>
>>>>>> GraphDatabaseService graphDb = new EmbeddedGraphDatabase("gbDir");
>>>>>> IndexService index = new LuceneIndexService(graphDb);
>>>>>> Transaction tx = graphDb.beginTx();
>>>>>> try {
>>>>>>    Node node = index.getSingleNode("name", "testName");
>>>>>>    if (node == null) {
>>>>>>        node = graphDb.createNode();
>>>>>>        node.setProperty("name", "testName");
>>>>>>        index.index(node, "name", "testName");
>>>>>>    }
>>>>>>    tx.success()
>>>>>> }
>>>>>> finally {
>>>>>>    tx.finish();
>>>>>>    index.shutdown();
>>>>>>    graphDb.shutdown();
>>>>>> }
>>>>>> _______________________________________________
>>>>>> Neo4j mailing list
>>>>>> User@lists.neo4j.org
>>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>>
>>>>> _______________________________________________
>>>>> Neo4j mailing list
>>>>> User@lists.neo4j.org
>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>
>>>> _______________________________________________
>>>> Neo4j mailing list
>>>> User@lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>
>>> _______________________________________________
>>> Neo4j mailing list
>>> User@lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>>
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to