Ambiguous method call. Both iterator () in KafkaStream and iterator () in KafkaStream match

ConsumerIterator<byte[],byte[]> it =stream.iterator();  
        这句代码老是报错,The method iterator() is ambiguous for the type KafkaStream<byte[],byte[]>

解决方法:将maven中配置
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>
  <configuration>
    <source>${jdk.version}</source>
    <target>${jdk.version}</target>
    <showWarnings>true</showWarnings>
  </configuration>
</plugin>
删除,然后给系统应用jdk1.8,这个问题一般是由于jdk的版本导致的。
 

转自:

https://blog.csdn.net/seven_zhao/article/details/49097269

猜你喜欢

转载自blog.csdn.net/leying521/article/details/83536353