当前位置:   article > 正文

IDEA报错:No hostname could be resolved for the IP address 127.0.0.1, using IP address as host name.

no hostname could be resolved for the ip address 127.0.0.1, using ip address

 idea编辑flink连接kafka读取数据时报错:

No hostname could be resolved for the IP address 127.0.0.1, using IP address as host name. Local input split assignment (such as for HDFS files) may be impacted.

kafka正常,该怎么解决?????

  1. package test
  2. import org.apache.flink.api.common.serialization.SimpleStringSchema
  3. import org.apache.flink.streaming.api.scala._
  4. import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
  5. import java.util.Properties
  6. object task {
  7. //fink采集kafka数据,分析写入redis
  8. def main(args: Array[String]): Unit = {
  9. // 创建运行环境
  10. val env = StreamExecutionEnvironment.getExecutionEnvironment
  11. env.setParallelism(1) //设置并行度
  12. //封装访问kafka集群的配置
  13. val prop = new Properties()
  14. prop.setProperty("bootstrap.servers", "master:9092")
  15. prop.setProperty("group.id", "order-group")
  16. //将kafka作为数据源添加进env
  17. // SimpleStringSchema,是因为kafka是纯字节存储,所以需要在代码中进行反序列化成对象,让Scala可以解析
  18. val stream = env.addSource(new FlinkKafkaConsumer[String]("order", new SimpleStringSchema(), prop))
  19. stream.print()
  20. env.execute()
  21. }
  22. }

 报错:

  1. C:\Users\Dell\.jdks\corretto-1.8.0_372\bin\java.exe "-javaagent:D:\zxy\IntelliJ IDEA Community Edition 2023.1.3\lib\idea_rt.jar=49820:D:\zxy\IntelliJ IDEA Community Edition 2023.1.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Dell\AppData\Local\Temp\classpath1711515240.jar test.task
  2. 2023-07-12 19:41:33,481 WARN [org.apache.flink.runtime.webmonitor.WebMonitorUtils] - Log file environment variable 'log.file' is not set.
  3. 2023-07-12 19:41:33,481 WARN [org.apache.flink.runtime.webmonitor.WebMonitorUtils] - JobManager log files are unavailable in the web dashboard. Log file location not found in environment variable 'log.file' or configuration key 'web.log.path'.
  4. 2023-07-12 19:41:35,146 WARN [org.apache.flink.runtime.taskmanager.Task] - Source: Custom Source -> Sink: Print to Std. Out (1/1)#0 (a8eadfe10e64678882479a27fb34f604) switched from RUNNING to FAILED with failure cause: java.lang.NoSuchMethodError: org.apache.flink.api.common.functions.RuntimeContext.getMetricGroup()Lorg/apache/flink/metrics/MetricGroup;
  5. at org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase.run(FlinkKafkaConsumerBase.java:705)
  6. at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:116)
  7. at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:73)
  8. at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:323)
  9. 2023-07-12 19:41:35,187 WARN [org.apache.flink.runtime.taskmanager.TaskManagerLocation] - No hostname could be resolved for the IP address 127.0.0.1, using IP address as host name. Local input split assignment (such as for HDFS files) may be impacted.
  10. Exception in thread "main" org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
  11. at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:144)
  12. at
  13. 进程已结束,退出代码1

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/283362
推荐阅读
相关标签
  

闽ICP备14008679号