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

spring-kafka-test doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.9-GA
    • fuse-7.8-GA
    • Spring Boot
    • None
    • False
    • False
    • % %
    • +
    • Automated
    • Undefined
      • The workaround is specifying zookeeper v3.5 and scala library v2.12 in the project pom.
    • Hide
      • Add spring-kafka-test dependency.
              <dependency>
                 <groupId>org.springframework.kafka</groupId>
                 <artifactId>spring-kafka-test</artifactId>
                 <scope>test</scope>
              </dependency>
        
      Show
      Add spring-kafka-test dependency. <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka-test</artifactId> <scope>test</scope> </dependency>

      [problem]

      • spring-kafka-test[1] doesn't work and error occurs using embedded kafka in junit test case because of inconsistent version of zookeeper and scala library.
      • Kafka 2.5 should be based on zookeeper v3.5 and scala library v2.12, however, when to use spring-kafka-test on Fuse it uses zookeeper v3.4 and scala library v2.11.
      • The workaround is specifying zookeeper v3.5 and scala library v2.12 in the project pom.
      • Fuse 7.8 doesn't includes spring-kafka-test[1] and it shouldn't be supported. However, a user claim that Fuse should be based on zookeeper v3.5 and scala library v2.12 because of Fuse 7.8 was tested with Kafka 2.5. so this may be a bug.

      [Environment]

      • Red Hat Fuse 7.8 on Spring boot 2 (7.8.0.fuse-sb2-780038-redhat-00001)

      [situation]

      • the project pom[1]
      • the dependency tree of project pom[2]
      • the effective-pom on the project pom[3]
      • zookeeper v3.4 and scala library v2.11 dependencies are specified in camel-parent pom[4], and on the other hand, <kafka-scala-version>2.12.10.redhat-00004</kafka-scala-version> and <kafka-zookeeper-version>3.5.7.redhat-00002</kafka-zookeeper-version> properties are also defined in camel-parent pom[4].

      [1] the project pom

            <fuse.bom.version>7.8.0.fuse-sb2-780038-redhat-00001</fuse.bom.version>
      ...
         </properties>
         <dependencyManagement>
            <dependencies>
               <dependency>
                  <groupId>org.jboss.redhat-fuse</groupId>
                  <artifactId>fuse-springboot-bom</artifactId>
                  <version>${fuse.bom.version}</version>
                  <type>pom</type>
                  <scope>import</scope>
               </dependency>
            </dependencies>
         </dependencyManagement>
         <dependencies>
      ...
            <dependency>
               <groupId>org.springframework.kafka</groupId>
               <artifactId>spring-kafka-test</artifactId>
               <scope>test</scope>
            </dependency>
      ...
      

      [2] the dependency tree of project pom

      [INFO] \- org.springframework.kafka:spring-kafka-test:jar:2.5.6.RELEASE:test
      ...
      [INFO]    +- org.apache.kafka:kafka_2.12:jar:2.5.0.redhat-00003:test (version managed from 2.5.1)
      ...
      [INFO]    |  +- com.fasterxml.jackson.module:jackson-module-scala_2.12:jar:2.9.10:test (version managed from 2.10.4.redhat-00001)
      [INFO]    |  |  +- (org.scala-lang:scala-library:jar:2.11.7:test - version managed from 2.12.10.redhat-00003; omitted for duplicate)
      [INFO]    |  |  +- (com.fasterxml.jackson.core:jackson-core:jar:2.9.10:test - version managed from 2.9.10.redhat-00003; omitted for duplicate)
      [INFO]    |  |  +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.9.10:test - version managed from 2.9.10.redhat-00003; omitted for duplicate)
      [INFO]    |  |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.10.4-redhat-00001:test - version managed from 2.9.10; omitted for duplicate)
      [INFO]    |  |  \- com.fasterxml.jackson.module:jackson-module-paranamer:jar:2.9.10:test
      [INFO]    |  |     +- (com.fasterxml.jackson.core:jackson-databind:jar:2.9.10.4-redhat-00001:test - version managed from 2.9.10; omitted for duplicate)
      [INFO]    |  |     \- com.thoughtworks.paranamer:paranamer:jar:2.8:test
      ...
      [INFO]    |  +- org.scala-lang.modules:scala-java8-compat_2.12:jar:0.9.0.redhat-00001:test
      [INFO]    |  |  \- (org.scala-lang:scala-library:jar:2.11.7:test - version managed from 2.12.4.redhat-7; omitted for duplicate)
      [INFO]    |  +- org.scala-lang:scala-library:jar:2.11.7:test
      [INFO]    |  +- org.scala-lang:scala-reflect:jar:2.12.10.redhat-00003:test
      [INFO]    |  |  +- (org.scala-lang:scala-library:jar:2.11.7:test - version managed from 2.12.10.redhat-00003; omitted for duplicate)
      [INFO]    |  |  \- org.scala-lang:scala-compiler:jar:2.12.10.redhat-00003:test
      [INFO]    |  |     +- (org.scala-lang:scala-compiler:jar:2.12.10.redhat-00003:test - omitted for cycle)
      [INFO]    |  |     \- (org.scala-lang:scala-compiler:jar:2.12.10.redhat-00003:test - omitted for duplicate)
      [INFO]    |  +- com.typesafe.scala-logging:scala-logging_2.12:jar:3.9.0.redhat-00008:test
      [INFO]    |  |  +- (org.scala-lang:scala-library:jar:2.11.7:test - version managed from 2.12.8.redhat-00003; omitted for duplicate)
      [INFO]    |  |  +- (org.slf4j:slf4j-api:jar:1.7.30:test - version managed from 1.7.25.redhat-00001; omitted for duplicate)
      [INFO]    |  |  \- (org.scala-lang:scala-reflect:jar:2.12.8.redhat-00003:test - omitted for conflict with 2.12.10.redhat-00003)
      ...
      [INFO]    |  +- org.apache.zookeeper:zookeeper:jar:3.4.14.redhat-00001:test (version managed from 3.5.8.redhat-00001)
      [INFO]    |  |  +- (org.slf4j:slf4j-api:jar:1.7.30:test - version managed from 1.7.22.redhat-1; omitted for duplicate)
      [INFO]    |  |  +- org.slf4j:slf4j-log4j12:jar:1.7.30:test (version managed from 1.7.22.redhat-1)
      [INFO]    |  |  |  +- (org.slf4j:slf4j-api:jar:1.7.30:test - version managed from 1.7.22.redhat-1; omitted for duplicate)
      [INFO]    |  |  |  \- (log4j:log4j:jar:1.2.17.redhat-3:test - version managed from 1.2.17; omitted for duplicate)
      [INFO]    |  |  +- log4j:log4j:jar:1.2.17.redhat-3:test
      [INFO]    |  |  +- jline:jline:jar:0.9.94.redhat-3:test
      [INFO]    |  |  +- org.apache.yetus:audience-annotations:jar:0.5.0.redhat-1:test
      [INFO]    |  |  \- io.netty:netty:jar:3.10.6.Final:test
      [INFO]    |  \- commons-cli:commons-cli:jar:1.4.0.redhat-00001:test
      

      [3] the effective-pom on the project pom

      ...
            <dependency>
              <groupId>org.apache.zookeeper</groupId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4898 -->
              <artifactId>zookeeper</artifactId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4899 -->
              <version>3.4.14.redhat-00001</version>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4900 -->
              <exclusions>
                <exclusion>
                  <artifactId>spotbugs-annotations</artifactId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4904 -->
                  <groupId>com.github.spotbugs</groupId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4903 -->
                </exclusion>
              </exclusions>
            </dependency>
      ...
            <dependency>
              <groupId>org.scala-lang</groupId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4400 -->
              <artifactId>scala-library</artifactId>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4401 -->
              <version>2.11.7</version>  <!-- org.apache.camel:camel-parent:2.23.2.fuse-780036-redhat-00001, line 4402 -->
            </dependency>
      

      [4] org/apache/camel/camel-parent/2.23.2.fuse-780036-redhat-00001/camel-parent-2.23.2.fuse-780036-redhat-00001.pom

          <kafka-scala-version>2.12.10.redhat-00004</kafka-scala-version>
          <kafka-zookeeper-version>3.5.7.redhat-00002</kafka-zookeeper-version>
      ...
          <scala-version>2.11.7</scala-version>
      ...
          <zookeeper-version>3.4.14.redhat-00001</zookeeper-version>
      ...
            <dependency>
              <groupId>org.scala-lang</groupId>
              <artifactId>scala-library</artifactId>
              <version>${scala-version}</version>
            </dependency>
      ...
            <!-- optional zookeeper dependency -->
            <dependency>
              <groupId>org.apache.zookeeper</groupId>
              <artifactId>zookeeper</artifactId>
              <version>${zookeeper-version}</version>
              <exclusions>
                <exclusion>
                  <groupId>com.github.spotbugs</groupId>
                  <artifactId>spotbugs-annotations</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
      

              ggrzybek Grzegorz Grzybek
              rhn-support-tyamashi Tomonari Yamashita
              Federico Mariani Federico Mariani
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: