Beginner Question - ElasticSearch and Java API

Hi!

I'm totally new to elasticsearch and I have troubles with elasticSearch + Java.

System:
Windows 7 (VirtualBox)
Eclipse JavaEE (Kepler)
JDK7
elasticsearch-0.90.3

Here is what I tried:

Started two nodes (cmd): .../elasticsearch.bat
checked by browser (http://127.0.0.1:9200) --> everything seems fine.
checked by cmd (curl -XGET http://127.0.0.1:9200/_cluster/health?pretty) --> ok!

Then I created a new Java Project:
(added "elasticsearch-0.90.3.jar" and "lucene-core-4.4.0.jar" in the build path)

import org.elasticsearch.node.Node;
import static org.elasticsearch.node.NodeBuilder.*;

public class test {
public static void main(String[] args) {
Node node = nodeBuilder().clusterName("elasticsearch").node();
node.close();
}
}

And the result is:

Aug 08, 2013 1:44:46 PM org.elasticsearch.node INFO: [Crown] version[0.90.3], pid[2724], build[5c38d60/2013-08-06T13:18:31Z] Aug 08, 2013 1:44:46 PM org.elasticsearch.node INFO: [Crown] initializing ... Aug 08, 2013 1:44:46 PM org.elasticsearch.plugins INFO: [Crown] loaded [], sites [] Exception in thread "main" org.elasticsearch.common.collect.ComputationException: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/standard/StandardAnalyzer at org.elasticsearch.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:887) 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:372) 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.(InternalNode.java:172) at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159) at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166) at test.test.main(test.java:8) Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/standard/StandardAnalyzer at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413) at java.lang.Class.getDeclaredConstructors(Class.java:1855) 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:356) at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:182) at org.elasticsearch.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:151) at org.elasticsearch.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:67) at org.elasticsearch.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:883) ... 15 more Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.standard.StandardAnalyzer at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 29 more

The result is not showing up, and without it, we cannot help. :slight_smile:

The elasticsearch jar should contain all the relevant Lucene class, so
there is no need to use the Lucene jar.

--
Ivan

On Thu, Aug 8, 2013 at 5:22 AM, Atelophobia new-account@gmx.net wrote:

Hi!

I'm totally new to elasticsearch and I have troubles with elasticSearch +
Java.

System:
Windows 7 (VirtualBox)
Eclipse JavaEE (Kepler)
JDK7
elasticsearch-0.90.3

Here is what I tried:

Started two nodes (cmd): .../elasticsearch.bat
checked by browser (http://127.0.0.1:9200) --> everything seems fine.
checked by cmd (curl -XGET http://127.0.0.1:9200/_cluster/health?pretty)
--> ok!

Then I created a new Java Project:
(added "elasticsearch-0.90.3.jar" and "lucene-core-4.4.0.jar" in the build
path)

And the result is:

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Beginner-Question-ElasticSearch-and-Java-API-tp4039323.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.