[Neo4j] LuceneIndexService: NoSuchMethodError

Alex D'Amour adamour at iq.harvard.edu
Fri Aug 6 18:52:44 CEST 2010


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 <adamour at 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.neubauer at 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.jakob at 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.neubauer at 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.jakob at 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 at lists.neo4j.org
>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>
>>>> _______________________________________________
>>>> Neo4j mailing list
>>>> User at lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>
>>> _______________________________________________
>>> Neo4j mailing list
>>> User at lists.neo4j.org
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>> _______________________________________________
>> Neo4j mailing list
>> User at lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>


More information about the User mailing list