javaspringspring-bootelasticsearchmahout

Integrate Apache Mahout with ElasticSearch in Spring Boot


I have a Spring Boot application integrated with ElasticSearch. When i am trying to add Apache Mahout as a maven dependency, the application is no longer running with this error:

Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/util/Accountable

If i remove the mahout dependency the application is running. pom.xml:

    <dependencies>
        <dependency>
            <groupId>org.apache.mahout</groupId>
            <artifactId>mahout-core</artifactId>
            <version>0.9</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


    </dependencies>

The dependency is resolved by maven, the project compiles with no error but when i start it, the server stops. Any idea? Thank you


Solution

  • In order to use the latest versions of Elasticsearc v6.x and Spring-boot, you have to focus on the matrix versions. because while I was trying to integrate Elasticsearch v6.2.2 as dependencies into my spring-boot v1.5.X I faced several errors. thus spring-boot v2.x is the compatible one with ES v6.x so the following link will help you to know the matrix between versions for your project : https://www.elastic.co/support/matrix#matrix_compatibility after doing that , use the last version of apache mahout .