Reputation: 2735
I'm trying to get proof of concept Java code working. The first thing I'm trying to do is index some txt documents on my HD. However I don't even get that far before running into exceptions when trying to create a Node.
The following code all produces the exception below:
Code
Node node = nodeBuilder().node();
Client client = node.client();
My main Questions is :
WHere can I get the BoundaryScanner class that seems to be missing? I'll provide my maven pom.xml below the exception. The lucene-fast-vector-highlighter package seems to be the lastest version 3.0.3.
Any help much appreciated.
Exception
07-Jun-2012 12:44:00 org.elasticsearch.node
INFO: [Allatou] {0.19.4}[2648]: initializing ...
07-Jun-2012 12:44:00 org.elasticsearch.plugins
INFO: [Allatou] loaded [], sites []
Exception in thread "main" org.elasticsearch.common.collect.ComputationException: java.lang.NoClassDefFoundError: org/apache/lucene/search/vectorhighlight/BoundaryScanner
at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:400)
at org.elasticsearch.common.inject.internal.FailableCache.get(FailableCache.java:49)
at org.elasticsearch.common.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
at org.elasticsearch.common.inject.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:50)
at org.elasticsearch.common.inject.InjectorImpl.initializeBinding(InjectorImpl.java:370)
at org.elasticsearch.common.inject.BindingProcessor$1$1.run(BindingProcessor.java:148)
at org.elasticsearch.common.inject.BindingProcessor.initializeBindings(BindingProcessor.java:204)
at org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:119)
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:102)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:59)
at org.elasticsearch.node.internal.InternalNode.<init>(InternalNode.java:149)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
at ie.openmobile.elasticsearch.Main.main(Main.java:49)
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/search/vectorhighlight/BoundaryScanner
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at org.elasticsearch.common.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:177)
at org.elasticsearch.common.inject.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:59)
at org.elasticsearch.common.inject.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at org.elasticsearch.common.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
at org.elasticsearch.common.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at org.elasticsearch.common.inject.internal.FailableCache$1.apply(FailableCache.java:38)
at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:358)
at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at org.elasticsearch.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:396)
... 15 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.search.vectorhighlight.BoundaryScanner
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 29 more
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.examplegroup</groupId>
<artifactId>artifacename</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>elasticsearch</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemPropertyVariables>
<user.region>uk</user.region>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- elasticsearch hosted here -->
<id>sonatype-releases</id>
<name>Sonatype Releases Repository</name>
<url>http://oss.sonatype.org/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-snowball</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-fast-vector-highlighter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>0.19.4</version>
</dependency>
</dependencies>
</project>
Upvotes: 0
Views: 2489
Reputation: 30163
It's not a good idea to mix different versions of Lucene components in the same project. You should be using 3.6.0 for everything. There were some changes in the recent versions, so you will need to replaces/remove some artifacts. For example, the Snowball analyzer is now in lucene-analyzers, so you shouldn't need lucene-snowball artifact, and lucene-fast-vector-highlighter is now in lucene-highlighter:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>3.6.0</version>
</dependency>
Upvotes: 3