# Compile error when using elastic search 2.0

**URL:** https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944
**Category:** Elasticsearch
**Created:** [November 6, 2015, 3:50am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944 "2015-11-06T03:50:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![wudadafan](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@wudadafan](https://discuss.elastic.co/u/wudadafan)
#### Post date: [November 6, 2015, 3:50am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/1 "2015-11-06T03:50:16Z")

</div>

Hi, all, I'm evaluating new elastic search 2.0 recently, try to upgrade from 1.4.2 to 2.0, but found some problem compiling my application.

I used the following setting in my pom,

```
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>2.0.0</version>
    </dependency>

```

but got errors when building my application. It complains can't find org.apache.lucene.util.BytesRef and org.joda.time.ReadableInstant class. I checked elasticsearch-2.0.0.jar, found they really doesn't exist there. And this is my lib list. Does anyone know what is the problem? How can I fix this? Thank you in advance.  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/c755e0b9430944174197845c2ab0386afe925a36.png)

---

<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 6, 2015, 6:02am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/2 "2015-11-06T06:02:51Z")

</div>

Lot of dependencies are missing here.  
You should may be reimport your maven project?

---

<div class="post-metadata">

### Author: ![wudadafan](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@wudadafan](https://discuss.elastic.co/u/wudadafan)
#### Post date: [November 6, 2015, 6:24am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/3 "2015-11-06T06:24:32Z")

</div>

I tried reimport, but it didn't help  
is it enough only include elastic search in pom?

```
<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>2.0.0</version>
</dependency>
```

---

<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 6, 2015, 6:46am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/4 "2015-11-06T06:46:14Z")

</div>

It's enough but apparently transitive deps are not here.

```
   mvn dependency:tree 

```

should give an idea

---

<div class="post-metadata">

### Author: ![wudadafan](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@wudadafan](https://discuss.elastic.co/u/wudadafan)
#### Post date: [November 6, 2015, 7:54am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/5 "2015-11-06T07:54:12Z")

</div>

Thank David for your suggestion.  
I ran the command, what confused me is when I use elastic search 1.4.2, it has a complete transitive deps, like this  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/a5fa0b357e564c97be5c96ba9ed9e5f9f0d57be3.png)

but when I use 2.0.0, it has deps missing, like this  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/16ab125717848335721e023fc425579e323f3fac.png)

is it caused by my maven? I'm using maven 3.3.3

---

<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 6, 2015, 8:06am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/6 "2015-11-06T08:06:31Z")

</div>

Can you share your `pom.xml`?

---

<div class="post-metadata">

### Author: ![wudadafan](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@wudadafan](https://discuss.elastic.co/u/wudadafan)
#### Post date: [November 6, 2015, 8:12am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/7 "2015-11-06T08:12:37Z")

</div>

I removed some internal information.

```
<?xml version="1.0" encoding="UTF-8"?><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>org.mogujie.trace</groupId>
<artifactId>lurker-logCenter</artifactId>
<version>1.0.2-SNAPSHOT</version>

<properties>
    <local.repo.host></local.repo.host>
</properties>

<dependencies>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>1.7.1</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.6</version>
    </dependency>
    <dependency>
        <groupId>com.mogujie.jafka</groupId>
        <artifactId>jafka-client</artifactId>
        <version>0.0.9.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>2.0.0</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.6</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Class-Path>../etc/</Class-Path>
                    </manifestEntries>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.mogujie.trace.logcenter.LurkerLogCenter</mainClass>
                    </manifest>
                </archive>
                <excludes>
                    <exclude>*.properties</exclude>
                    <exclude>logback.xml</exclude>
                    <exclude>logcenter.xml</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions> 
                <execution>
                    <id>make-zip</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptors> 
                            <descriptor>src/main/assembly/zip.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

```

---

<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 6, 2015, 9:45am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/8 "2015-11-06T09:45:39Z")

</div>

I tried your pom.xml but excluded `jafka-client` as I don't know it and I got this:

```auto
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ lurker-logCenter ---
[INFO] org.mogujie.trace:lurker-logCenter:jar:1.0.2-SNAPSHOT
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.slf4j:log4j-over-slf4j:jar:1.7.1:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.1:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.6:compile
[INFO] | \- ch.qos.logback:logback-core:jar:1.0.6:compile
[INFO] +- org.elasticsearch:elasticsearch:jar:2.0.0:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:5.2.1:compile
[INFO] | | \- org.apache.lucene:lucene-sandbox:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:5.2.1:compile
[INFO] | | \- org.apache.lucene:lucene-misc:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:5.2.1:compile
[INFO] | | \- org.apache.lucene:lucene-grouping:jar:5.2.1:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:5.2.1:compile
[INFO] | | \- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] | +- com.google.guava:guava:jar:18.0:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] | +- joda-time:joda-time:jar:2.8.2:compile
[INFO] | +- org.joda:joda-convert:jar:1.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.5.3:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.5.3:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.12:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.5.3:compile
[INFO] | +- io.netty:netty:jar:3.10.5.Final:compile
[INFO] | +- com.ning:compress-lzf:jar:1.0.2:compile
[INFO] | +- com.tdunning:t-digest:jar:3.0:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.6:compile
[INFO] | +- commons-cli:commons-cli:jar:1.3.1:compile
[INFO] | \- com.twitter:jsr166e:jar:1.1.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] | \- commons-codec:commons-codec:jar:1.2:compile
[INFO] \- com.alibaba:fastjson:jar:1.2.6:compile

```

So may be you have a problem there?

---

<div class="post-metadata">

### Author: ![wudadafan](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@wudadafan](https://discuss.elastic.co/u/wudadafan)
#### Post date: [November 6, 2015, 10:04am UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/9 "2015-11-06T10:04:00Z")

</div>

well, I removed jafka-client and still has those deps missing, what a bad luck...  
There must be something wrong, it's so weird... I need time to figure it out

Anyway, thank you all the same, David .

---

<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 5, 2017, 11:40pm UTC](https://discuss.elastic.co/t/compile-error-when-using-elastic-search-2-0/33944/10 "2017-07-05T23:40:11Z")

</div>


