# POM.xml dependencies

**URL:** <https://discuss.elastic.co/t/pom-xml-dependencies/73181>\
**Category:** Elasticsearch\
**Created:** [January 30, 2017, 10:03am UTC](https://discuss.elastic.co/t/pom-xml-dependencies/73181 "2017-01-30T10:03:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharongur](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@sharongur](https://discuss.elastic.co/u/sharongur)\
**Post date:** [January 30, 2017, 10:03am UTC](https://discuss.elastic.co/t/pom-xml-dependencies/73181/1 "2017-01-30T10:03:41Z")

</div>

Hi all,  
I run into many many problems with the dependencies of my java client.

I want to make a simple client that enters something to the ES  
here is my code  
"

```
Settings settings = Settings.builder()
		      .put("cluster.name", "sharongur").build();

		Client client = new PreBuiltTransportClient(settings)
							.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
		
		IndicesAdminClient indicesAdminClient = client.admin().indices();
		
		String json = "{" +

                "\"user\":\"sharon\"," +
                "\"postDate\":\"2013-01-30\"," +
                "\"message\":\"trying out Elasticsearch\"" +
            "}";
		
	IndexResponse response = client.prepareIndex("twitter", "tweet", "1")
	        .setSource(json)
	        .get();
	
	// Index name
	String _index = response.getIndex();
	// Type name
	String _type = response.getType();
	// Document ID (generated or not)
	String _id = response.getId();
	// Version (if it's the first time you index this document, you will get: 1)
	long _version = response.getVersion();
	
			client.close();

```

"

each time a different file is not found, and when i look for google i see many problems from different timelines and different solutions that im not sure are updated.  
Im using ES 5.1.2.

This is my POM  
"

```
		<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>com.sharongur.xdr</groupId>
  <artifactId>ElasticTest</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <packaging>jar</packaging>

 <name>ElasticTest</name>
<url>http://maven.apache.org</url>

 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
  <!-- add the elasticsearch repo -->
   <repository>
      <id>elasticsearch-releases</id>
      <url>https://maven.elasticsearch.org/releases</url>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>false</enabled>
      </snapshots>
   </repository>
</repositories>

 <dependencies>
 <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>3.8.1</version>
   <scope>test</scope>
 </dependency>
 <dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>5.1.2</version>
</dependency>
   <dependency>
    <groupId>org.apache.servicemix.bundles</groupId>
    <artifactId>org.apache.servicemix.bundles.elasticsearch</artifactId>
    <version>2.0.1_3</version>
	</dependency>
    <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.8</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.8</version>
  </dependency>
     <dependency>
     <groupId>com.sparkjava</groupId>
     <artifactId>spark-core</artifactId>
      <version>2.3</version>
 </dependency>
 <dependency>
        <groupId>com.sparkjava</groupId>
     <artifactId>spark-template-freemarker</artifactId>
    <version>2.3</version>
 </dependency>
   </dependencies>
    <build>
	   <plugins>
		    <!-- <plugin>
		      	<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin> -->
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.3</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
		   	  </configuration>
		   </plugin>
	   </plugins>
    </build>
    </project>

```

"

Someone has a complete UPDATED pom example so i wont run into issues?

P.S- my current issue is  
"  
\> Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/transport/Netty3Plugin

> at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:84)  
> at com.sharongur.main.Main.main(Main.java:21)  
> Caused by: java.lang.ClassNotFoundException: org.elasticsearch.transport.Netty3Plugin  
> at java.net.URLClassLoader.findClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> ... 2 more  
> "

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 31, 2017, 10:12am UTC](https://discuss.elastic.co/t/pom-xml-dependencies/73181/2 "2017-01-31T10:12:31Z")

</div>

Hey,

the `org.apache.servicemix.bundles.elasticsearch` artifact imports an old shaded elasticsearch versions, which clashes when you run your application.

--Alex

---

<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:** [February 28, 2017, 10:12am UTC](https://discuss.elastic.co/t/pom-xml-dependencies/73181/3 "2017-02-28T10:12:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
