Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-2990

NoSuchMethodError when Kafka is compiled with 1.8 and run on 1.7

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.0.1, 0.10.0.0
    • Component/s: None
    • Labels:
      None

      Description

      I saw the following exception in the server logs when Kafka is compiled with 1.8 jdk and run on a 1.7.

      java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
              at kafka.utils.Pool.keys(Pool.scala:79)
              at kafka.coordinator.GroupMetadataManager.kafka$coordinator$GroupMetadataManager$$removeGroupsAndOffsets$1(GroupMetadataManager.scala:483)
              at kafka.coordinator.GroupMetadataManager$$anonfun$removeGroupsForPartition$1.apply$mcV$sp(GroupMetadataManager.scala:465)
              at kafka.utils.KafkaScheduler$$anonfun$1.apply$mcV$sp(KafkaScheduler.scala:110)
              at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:60)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      

      The keySet() method for ConcurrentHashMap was changed in 1.8 to refer to KeySetView, which didn't exist in 1.7. To fix it, we just need to make sure that Pool calls ConcurrentMap.keySet() instead.

        Attachments

          Activity

            People

            • Assignee:
              hachikuji Jason Gustafson
              Reporter:
              hachikuji Jason Gustafson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: