Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-16892

Elastic Search Rest cannot be used on SpringBoot

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • fuse-7.10-GA
    • fuse-7.8-GA
    • Spring Boot
    • None
    • False
    • False
    • % %
    • Todo
    • Undefined
    • Hide

      1. Init project with fuse archetype ( using 6: spring-boot-camel-archetype ) 

       

      export FUSE_ARCHETYPE_VERSION=2.2.0.fuse-sb2-780040-redhat-00002
      mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \
        -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/${FUSE_ARCHETYPE_VERSION}/archetypes-catalog-${FUSE_ARCHETYPE_VERSION}-archetype-catalog.xml
      

       

       

      2. Add camel-elastisearch-rest-started dependency

      <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-elasticsearch-rest-starter</artifactId>
      </dependency>

      3. Edit example route to use elasticsearch-rest 

       

      from("timer://foo?period=5000")
          .to("elasticsearch-rest://elasticsearch?operation=Search&indexName=twitter")
          .log(">>> ${body}");
      

      4. Run the application

       

      Actual result is that springboot fails at startup with the following exception

      java.lang.IllegalStateException: Error processing condition on org.apache.camel.component.file.springboot.FileComponentAutoConfiguration
      	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
      ...[org.apache.camel.component.elasticsearch.springboot.ElasticsearchComponentAutoConfiguration]
      ...
      Caused by: java.lang.ClassNotFoundException: org.apache.camel.component.elasticsearch.ElasticsearchComponent
      
      

       

      The exception has thrown because of the @ConditionalOnMissingBean defined into the ElasticsearchComponentAutoConfiguration

       

      A. Even adding the camel-elasticsearch dependency

      <dependency>
          <groupId>org.apache.camel</groupId>
          <artifactId>camel-elasticsearch</artifactId>
      </dependency>
      

       the application keep failing at startup, now with the exception 

      15:17:19.988 [main] ERROR o.s.boot.SpringApplication - Application run failed15:17:19.988 [main] ERROR o.s.boot.SpringApplication - Application run failedjava.lang.NoClassDefFoundError: org/elasticsearch/action/WriteConsistencyLevel at org.apache.camel.component.elasticsearch.ElasticsearchConstants.<clinit>(ElasticsearchConstants.java:48) at org.apache.camel.component.elasticsearch.ElasticsearchConfiguration.<init>(ElasticsearchConfiguration.java:43) at org.apache.camel.component.elasticsearch.ElasticsearchComponent.createEndpoint(ElasticsearchComponent.java:50) at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:126)
      

      B. The org.elasticsearch:elasticsearch version is 7.6.2 and the WriteConsistencyLevel is no more present since 5.0.0-alpha1. 

      [INFO] +- org.apache.camel:camel-elasticsearch:jar:2.23.2.fuse-780036-redhat-00001:compile
      [INFO] |  +- org.apache.camel:camel-core:jar:2.23.2.fuse-780036-redhat-00001:compile
      [INFO] |  +- org.elasticsearch:elasticsearch:jar:7.6.2:compile
      
      
      Show
      1. Init project with fuse archetype ( using 6: spring-boot-camel-archetype )    export FUSE_ARCHETYPE_VERSION=2.2.0.fuse-sb2-780040-redhat-00002 mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \   -DarchetypeCatalog=https: //maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/${FUSE_ARCHETYPE_VERSION}/archetypes-catalog-${FUSE_ARCHETYPE_VERSION}-archetype-catalog.xml     2. Add camel-elastisearch-rest-started dependency <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch- rest -starter</artifactId> </dependency> 3. Edit example route to use elasticsearch-rest    from( "timer: //foo?period=5000" ) .to( "elasticsearch- rest : //elasticsearch?operation=Search&indexName=twitter" ) .log( ">>> ${body}" ); 4. Run the application   Actual result is that springboot fails at startup with the following exception java.lang.IllegalStateException: Error processing condition on org.apache.camel.component.file.springboot.FileComponentAutoConfiguration at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ...[org.apache.camel.component.elasticsearch.springboot.ElasticsearchComponentAutoConfiguration] ... Caused by: java.lang.ClassNotFoundException: org.apache.camel.component.elasticsearch.ElasticsearchComponent   The exception has thrown because of the @ConditionalOnMissingBean defined into the ElasticsearchComponentAutoConfiguration   A. Even adding the camel-elasticsearch dependency <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-elasticsearch</artifactId> </dependency>  the application keep failing at startup, now with the exception  15:17:19.988 [main] ERROR o.s.boot.SpringApplication - Application run failed15:17:19.988 [main] ERROR o.s.boot.SpringApplication - Application run failedjava.lang.NoClassDefFoundError: org/elasticsearch/action/WriteConsistencyLevel at org.apache.camel.component.elasticsearch.ElasticsearchConstants.<clinit>(ElasticsearchConstants.java:48) at org.apache.camel.component.elasticsearch.ElasticsearchConfiguration.<init>(ElasticsearchConfiguration.java:43) at org.apache.camel.component.elasticsearch.ElasticsearchComponent.createEndpoint(ElasticsearchComponent.java:50) at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:126) B. The org.elasticsearch:elasticsearch version is 7.6.2 and the WriteConsistencyLevel is no more present since 5.0.0-alpha1.  [INFO] +- org.apache.camel:camel-elasticsearch:jar:2.23.2.fuse-780036-redhat-00001:compile [INFO] | +- org.apache.camel:camel-core:jar:2.23.2.fuse-780036-redhat-00001:compile [INFO] | +- org.elasticsearch:elasticsearch:jar:7.6.2:compile

    Description

      I tried to use the ElasticSearchRest component on SpringBoot without success.

      Attachments

        Activity

          People

            rnetuka@redhat.com Radovan Netuka
            saiello@redhat.com Simone Aiello
            Tomas Veskrna Tomas Veskrna
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: