0.90.0 RC2 Java API Compilation Error: "org.apache.lucene.util.ByteRef cannot be resolved"

ES 0.90.0.RC2

I recently upgraded to ES 0.90.0.RC2 from 0.20.6, and I noticed that my
JAVA client doesn't compile anymore. I used to only have
elasticsearch-0.20.6.jar in my project classpath, and I replaced it with
elasticsearch-0.90.0.rc2.jar. The offending class is *
org.apache.lucene.util.BytesRef*, but this is used at quite a number of
places. I found out from the source that this class is packaged in
lucene-core-4.2.1.jar, grabbed that class (and some more like
BytesRefComparator, UnicodeUtil after subsequent runtime errors),
unpackaged elasticsearch-0.90.0.rc2.jar, and copied the class in the
appropriate places. This gets rid of the compilation and runtime errors,
however, performing a JAR surgery like this makes me a bit uncomfortable.

I was under the impression that elasticsearch-0.90.0.rc2.jar is all you
need while creating a client for ES. So shouldn't it run standalone without
depending on any other libraries in the lib/ directory? Am I missing
something? Here is the error I see in Eclipse:

XContentBuilder o = XContentFactory.jsonBuilder().startObject();
o.field("line", "this is a test line"); // Error: "Type
org.apache.lucene.util.ByteRef cannot be resolved. It is indirectly
referenced from required .class files"

--
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 should check if you have more than one Lucene jar in your class path.
So clean your target directory or something like that.

HTH

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 23 avr. 2013 à 04:36, Harkirat Singh singh.harkirat@gmail.com a écrit :

ES 0.90.0.RC2

I recently upgraded to ES 0.90.0.RC2 from 0.20.6, and I noticed that my JAVA client doesn't compile anymore. I used to only have elasticsearch-0.20.6.jar in my project classpath, and I replaced it with elasticsearch-0.90.0.rc2.jar. The offending class is org.apache.lucene.util.BytesRef, but this is used at quite a number of places. I found out from the source that this class is packaged in lucene-core-4.2.1.jar, grabbed that class (and some more like BytesRefComparator, UnicodeUtil after subsequent runtime errors), unpackaged elasticsearch-0.90.0.rc2.jar, and copied the class in the appropriate places. This gets rid of the compilation and runtime errors, however, performing a JAR surgery like this makes me a bit uncomfortable.

I was under the impression that elasticsearch-0.90.0.rc2.jar is all you need while creating a client for ES. So shouldn't it run standalone without depending on any other libraries in the lib/ directory? Am I missing something? Here is the error I see in Eclipse:

XContentBuilder o = XContentFactory.jsonBuilder().startObject();
o.field("line", "this is a test line"); // Error: "Type org.apache.lucene.util.ByteRef cannot be resolved. It is indirectly referenced from required .class files"

--
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.

Created a new issue for
tracking: https://github.com/elasticsearch/elasticsearch/issues/2950

-Hark

On Monday, April 22, 2013 10:36:29 PM UTC-4, Harkirat Singh wrote:

ES 0.90.0.RC2

I recently upgraded to ES 0.90.0.RC2 from 0.20.6, and I noticed that my
JAVA client doesn't compile anymore. I used to only have
elasticsearch-0.20.6.jar in my project classpath, and I replaced it with
elasticsearch-0.90.0.rc2.jar. The offending class is *
org.apache.lucene.util.BytesRef*, but this is used at quite a number of
places. I found out from the source that this class is packaged in
lucene-core-4.2.1.jar, grabbed that class (and some more like
BytesRefComparator, UnicodeUtil after subsequent runtime errors),
unpackaged elasticsearch-0.90.0.rc2.jar, and copied the class in the
appropriate places. This gets rid of the compilation and runtime errors,
however, performing a JAR surgery like this makes me a bit uncomfortable.

I was under the impression that elasticsearch-0.90.0.rc2.jar is all you
need while creating a client for ES. So shouldn't it run standalone without
depending on any other libraries in the lib/ directory? Am I missing
something? Here is the error I see in Eclipse:

XContentBuilder o = XContentFactory.jsonBuilder().startObject();
o.field("line", "this is a test line"); // Error: "Type
org.apache.lucene.util.ByteRef cannot be resolved. It is indirectly
referenced from required .class files"

--
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.

The class org.apache.lucene.util.ByteRef was patched by ES before 0.90 and
that version was included in the ES jar but this is no longer the case in
0.90

Note, ES did never include the Lucene jars by intention. You have to add
this dependency separately. I agree this is confusing developers (there are
more confusing things when it comes to shading dependencies into the ES jar
and to the optional jars). I assume this is just because ES deployments can
be upgraded to a fix version of Lucene without the release of a new ES
version.

Of course, you can build your own version of ES, adding Lucene as a shaded
jar.
Jörg

On Tuesday, April 23, 2013 4:36:29 AM UTC+2, Harkirat Singh wrote:

ES 0.90.0.RC2

I recently upgraded to ES 0.90.0.RC2 from 0.20.6, and I noticed that my
JAVA client doesn't compile anymore. I used to only have
elasticsearch-0.20.6.jar in my project classpath, and I replaced it with
elasticsearch-0.90.0.rc2.jar. The offending class is *
org.apache.lucene.util.BytesRef*, but this is used at quite a number of
places. I found out from the source that this class is packaged in
lucene-core-4.2.1.jar, grabbed that class (and some more like
BytesRefComparator, UnicodeUtil after subsequent runtime errors),
unpackaged elasticsearch-0.90.0.rc2.jar, and copied the class in the
appropriate places. This gets rid of the compilation and runtime errors,
however, performing a JAR surgery like this makes me a bit uncomfortable.

I was under the impression that elasticsearch-0.90.0.rc2.jar is all you
need while creating a client for ES. So shouldn't it run standalone without
depending on any other libraries in the lib/ directory? Am I missing
something? Here is the error I see in Eclipse:

XContentBuilder o = XContentFactory.jsonBuilder().startObject();
o.field("line", "this is a test line"); // Error: "Type
org.apache.lucene.util.ByteRef cannot be resolved. It is indirectly
referenced from required .class files"

--
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.