1. 程式人生 > >Ambiguous method call. Both iterator () in KafkaStream and iterator () in KafkaStream match

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