# Unable to get ElasticsearchTestCase to work due to dependency hell

**URL:** <https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943>\
**Category:** Elasticsearch\
**Created:** [November 25, 2014, 7:45pm UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943 "2014-11-25T19:45:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![burtonator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burtonator/32/44790_2.png) [@burtonator](https://discuss.elastic.co/u/burtonator)\
**Post date:** [November 25, 2014, 7:45pm UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943/1 "2014-11-25T19:45:35Z")

</div>

I'm trying to use ElasticsearchTestCase in my test framework to start  
getting ES deployed in production.

However, I'm in maven dependency hell and wanted some advice.

I'm trying to use this:

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html)

but when I extend ElasticsearchTestCase and run the tests I get missing  
dependencies (see below)

It seems there are 2-4 problem here all exacerbating the issue:

1. the lucene.version, lucene.maven.version, and elastisearch.version are  
all undefined in the docs so I have to track down what these should be.

2. I have to add additional repositories (references in the main project  
pom) to get these to work:

[https://download.elasticsearch.org/lucenesnapshots/1641343](https://download.elasticsearch.org/lucenesnapshots/1641343)

1. I don't think test-jar pulls in dependencies properly.  
I've never used this feature and instead put my test infra in foo-test so  
that it's a normal dependency. So something seems fishy.

2. I seem that you're depending on these jars in the main pom.. but for  
some reason they're not being deployed into my project.

... any advice here would be appreciated.

java.lang.NoClassDefFoundError: org/apache/lucene/index/LeafReader  
at \_\_randomizedtesting.SeedInfo.seed([B3DCF11EC4F020A1]:0)  
at  
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
at  
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
at  
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
at  
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
at  
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
at  
com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
at java.lang.Thread.run(Thread.java:724)  
Caused by: java.lang.ClassNotFoundException:  
org.apache.lucene.index.LeafReader  
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:424)  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
at  
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
at  
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
at  
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
at  
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
at  
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
at  
com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
at java.lang.Thread.run(Thread.java:724)

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 25, 2014, 8:22pm UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943/2 "2014-11-25T20:22:37Z")

</div>

Hi Kevin,

You should look at some plugins code, such as: [GitHub - elastic/elasticsearch-analysis-icu: ICU Analysis plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-icu)

I think this should help.

Best.

David

> Le 25 nov. 2014 à 20:45, Kevin Burton [burtonator@gmail.com](mailto:burtonator@gmail.com) a écrit :
> 
> I'm trying to use ElasticsearchTestCase in my test framework to start getting ES deployed in production.
> 
> However, I'm in maven dependency hell and wanted some advice.
> 
> I'm trying to use this:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html)
> 
> but when I extend ElasticsearchTestCase and run the tests I get missing dependencies (see below)
> 
> It seems there are 2-4 problem here all exacerbating the issue:
> 
> 1. the lucene.version, lucene.maven.version, and elastisearch.version are all undefined in the docs so I have to track down what these should be.
> 
> 2. I have to add additional repositories (references in the main project pom) to get these to work:
> 
> 3. I don't think test-jar pulls in dependencies properly. I've never used this feature and instead put my test infra in foo-test so that it's a normal dependency. So something seems fishy.
> 
> 4. I seem that you're depending on these jars in the main pom.. but for some reason they're not being deployed into my project.
> 
> ... any advice here would be appreciated.
> 
> java.lang.NoClassDefFoundError: org/apache/lucene/index/LeafReader  
> at \_\_randomizedtesting.SeedInfo.seed([B3DCF11EC4F020A1]:0)  
> at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
> at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
> at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
> at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
> at java.lang.Thread.run(Thread.java:724)  
> Caused by: java.lang.ClassNotFoundException: org.apache.lucene.index.LeafReader  
> 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:424)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
> at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
> at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
> at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
> at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
> at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
> at java.lang.Thread.run(Thread.java:724)
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5D468582-A71F-4D1C-9169-F797D381C539%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/5D468582-A71F-4D1C-9169-F797D381C539%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![burtonator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burtonator/32/44790_2.png) [@burtonator](https://discuss.elastic.co/u/burtonator)\
**Post date:** [November 25, 2014, 8:35pm UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943/3 "2014-11-25T20:35:30Z")

</div>

yeah.. doing that I am still getting the following no class def error:

... this really sucks. Should just work out of the box. Testing is kind  
of the first thing I would expect most people to want to do...

java.lang.NoClassDefFoundError: org/apache/lucene/index/LeafReader

at \_\_randomizedtesting.SeedInfo.seed([5869799789B6B704]:0)

at  
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)

at  
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)

at  
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)

at  
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)

at  
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)

at  
com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)

at java.lang.Thread.run(Thread.java:724)

Caused by: java.lang.ClassNotFoundException:  
org.apache.lucene.index.LeafReader

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:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at  
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)

at  
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)

at  
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)

at  
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)

at  
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)

at  
com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)

at java.lang.Thread.run(Thread.java:724)

On Tuesday, November 25, 2014 12:23:02 PM UTC-8, David Pilato wrote:

> Hi Kevin,
> 
> You should look at some plugins code, such as:  
> [GitHub - elastic/elasticsearch-analysis-icu: ICU Analysis plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-icu)
> 
> I think this should help.
> 
> Best.
> 
> David
> 
> Le 25 nov. 2014 à 20:45, Kevin Burton \<[burto...@gmail.com](mailto:burto...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> I'm trying to use ElasticsearchTestCase in my test framework to start  
> getting ES deployed in production.
> 
> However, I'm in maven dependency hell and wanted some advice.
> 
> I'm trying to use this:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/using-elasticsearch-test-classes.html)
> 
> but when I extend ElasticsearchTestCase and run the tests I get missing  
> dependencies (see below)
> 
> It seems there are 2-4 problem here all exacerbating the issue:
> 
> 1. the lucene.version, lucene.maven.version, and elastisearch.version are  
> all undefined in the docs so I have to track down what these should be.
> 
> 2. I have to add additional repositories (references in the main project  
> pom) to get these to work:
> 
> [https://download.elasticsearch.org/lucenesnapshots/1641343](https://download.elasticsearch.org/lucenesnapshots/1641343)
> 
> 1. I don't think test-jar pulls in dependencies properly.  
> I've never used this feature and instead put my test infra in foo-test so  
> that it's a normal dependency. So something seems fishy.
> 
> 2. I seem that you're depending on these jars in the main pom.. but for  
> some reason they're not being deployed into my project.
> 
> ... any advice here would be appreciated.
> 
> java.lang.NoClassDefFoundError: org/apache/lucene/index/LeafReader  
> at \_\_randomizedtesting.SeedInfo.seed([B3DCF11EC4F020A1]:0)  
> at  
> org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
> at  
> org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
> at  
> org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
> at  
> org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
> at  
> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at  
> com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
> at java.lang.Thread.run(Thread.java:724)  
> Caused by: java.lang.ClassNotFoundException:  
> org.apache.lucene.index.LeafReader  
> 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:424)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)  
> at  
> org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:35)  
> at  
> org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)  
> at  
> org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:65)  
> at  
> org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)  
> at  
> com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
> at  
> com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:365)  
> at java.lang.Thread.run(Thread.java:724)
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a10f3167-c739-4763-abe5-f05369496572%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/689a504c-cdd1-4303-80bd-8ae35da685ab%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/689a504c-cdd1-4303-80bd-8ae35da685ab%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![burtonator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burtonator/32/44790_2.png) [@burtonator](https://discuss.elastic.co/u/burtonator)\
**Post date:** [November 25, 2014, 10:14pm UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943/4 "2014-11-25T22:14:31Z")

</div>

Ended up resolving this. I had to take the 1.4.0 pom and use the  
dependencies there instead of the dependencies from master which was  
2.0.0-SNAPSHOT...

... things sort of work now but still running into some small problems.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5d593d01-fcfe-410c-a2ee-dba1862305e6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5d593d01-fcfe-410c-a2ee-dba1862305e6%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:47am UTC](https://discuss.elastic.co/t/unable-to-get-elasticsearchtestcase-to-work-due-to-dependency-hell/20943/5 "2017-07-06T00:47:34Z")

</div>


