Guice creation errors: org.elasticsearch.Version

Hi everybody,

I'm developing a simple java app in an eclipse IDE and with weblogic.
I'm using elasticsearch-0.90.5.jar and lucene-core-4.4.0.jar for it.

When I try to create a connection with elasticSearch I get an exception in this line:

TransportClient tClient = new TransportClient(settings);

And the trace I get is:

org.elasticsearch.common.inject.CreationException: Guice creation errors:

  1. Could not find a suitable constructor in org.elasticsearch.Version. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.elasticsearch.Version.class(Unknown Source)
    while locating org.elasticsearch.Version
    for parameter 3 at org.elasticsearch.transport.netty.NettyTransport.(Unknown Source)
    at org.elasticsearch.transport.netty.NettyTransportModule.configure(NettyTransportModule.java:39)

  2. Could not find a suitable constructor in org.elasticsearch.Version. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at org.elasticsearch.Version.class(Unknown Source)
    while locating org.elasticsearch.Version
    for parameter 4 at org.elasticsearch.client.transport.TransportClientNodesService.(Unknown Source)
    at org.elasticsearch.client.transport.ClientTransportModule.configure(ClientTransportModule.java:39)

2 errors
at org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)
at org.elasticsearch.common.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:151)
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)

I don´t know what is happening, as the class org.elasticsearch.Version is the one that comes in the elasticsearch-0.90.5.jar.

Any clue about it???

Thanks

Oscar

0.90.5 is very old and is no longer supported. It hasn't been supported for over a year (maybe even 2 years). I would suggest developing your app on the latest Elasticsearch version (2.3.2).

Thanks for your reply.

The fact is that I cannot change the 0.90.5 version because there are other apps that are already using this version. At this moment the update to the new version is not planned :cry:

Oscar

Ok, I would push to update the version as soon as possible as it will become harder to upgrade the longer you leave it

For you actual problem it is heard to know the exact cause but I would say that either you have a classpath conflict and you unknowingly have another version of Elasticsearch.jar in your classpath somewhere, or you elasticsearch.jar has somehow become corrupted (although this is unlikely as I would expect the jar not to be able to be read at all rather than fail on a specific class)

The error is misleading. Are you sure you have the correct Lucene jars in your classpath? You have to include the Lucene jars in your classpath, otherwise org.elasticsearch.Version returns an instantiation exception, which again confuses Guice injection. Elasticsearch jar alone in the classpath is not sufficient. This is probably an IDE issue.

I have those jars in my classpath:

  • elasticsearch-0.90.5.jar
  • jna-3.3.0.jar
  • jts-1.12.jar
  • log4j-1.2.17.jar
  • lucene-analyzers-common-4.4.0.jar
  • lucene-codecs-4.4.0.jar
  • lucene-core-4.4.0.jar
  • lucene-grouping-4.4.0.jar
  • lucene-highlighter-4.4.0.jar
  • lucene-join-4.4.0.jar
  • lucene-memory-4.4.0.jar
  • lucene-misc-4.4.0.jar
  • lucene-queries-4.4.0.jar
  • lucene-queryparser-4.4.0.jar
  • lucene-sandbox-4.4.0.jar
  • lucene-spatial-4.4.0.jar
  • lucene-suggest-4.4.0.jar
  • spatial4j-0.3.jar