Class NetworkPlugin has not found- Elasticsearch 6.1.1


(Adam Lasota) #1

Application throws java.lang.ClassNotFoundException: org.elasticsearch.plugins.NetworkPlugin. In the pom I added two dependencies:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>6.1.1</version>
</dependency>
<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>6.1.1</version>
</dependency>



 private static final String SERVER_IP = "127.0.0.1";
  private static final Integer SERVER_PORT = 9300;

    @Bean
    public TransportClient transportClient() throws UnknownHostException {

        return new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(
                new TransportAddress(InetAddress.getByName(SERVER_IP), SERVER_PORT));;
    }

Before this post I deleted all files inside .m2 folder and reimport all dependencies. Anybody has idea where can be a problem?

Today I focused on available maven repository for this project and found two different dependencies, but I can't find older version in maven pom. I attach image with print screen: ibb.co/mUgU4G . Older elasticsearch version is marked as parent and is a third party pom. Thank you for reply :slight_smile:


(David Pilato) #2

Just run:

mvn dependency:tree

And you will see which other lib brings Elasticsearch 2.

As you did not share your full pom.xml here, it's hard to know.


(Adam Lasota) #3

Raport

dependencyTreeMain - dependency report from the whole project (dependency:tree),
pomCore file - it is a module where I have implement TransportClient to Elasticsearch.

org.elasticsearch.client:transport:6.1.1 has org.elasticsearch:elasticsearch:2.4.6

Problem should be easier to find. Additionally in the project I am using Spring Boot.


(David Pilato) #4

Could you share that as gist.github.com instead ?

And yes I was suspecting you are using Spring. You need to fix the spring deps I think.


(Adam Lasota) #5

Yes of course

gist.github raport


(Adam Lasota) #6

Problem has been resolved: Spring Boot has default elasticsearch version below 5.0.0. The solution was by adding properties with version Elasticsearch, which we want to use in application. @dadoonet, thank you very much. You have been right about the conflict of dependencies Spring.


(system) #7

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