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的版本导致的。
转自: