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

 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正常,该怎么解决?????

package test

  import org.apache.flink.api.common.serialization.SimpleStringSchema
  import org.apache.flink.streaming.api.scala._
  import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer
  import java.util.Properties

object task {

  //fink采集kafka数据,分析写入redis
  def main(args: Array[String]): Unit = {
    //  创建运行环境
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1) //设置并行度
    //封装访问kafka集群的配置
    val prop = new Properties()
      prop.setProperty("bootstrap.servers", "master:9092")
    prop.setProperty("group.id", "order-group")

    //将kafka作为数据源添加进env
    //      SimpleStringSchema,是因为kafka是纯字节存储,所以需要在代码中进行反序列化成对象,让Scala可以解析

    val stream = env.addSource(new FlinkKafkaConsumer[String]("order", new SimpleStringSchema(), prop))
    stream.print()
    env.execute()

  }
}

 报错:

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
2023-07-12 19:41:33,481 WARN [org.apache.flink.runtime.webmonitor.WebMonitorUtils] - Log file environment variable 'log.file' is not set.
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'.
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;
	at org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase.run(FlinkKafkaConsumerBase.java:705)
	at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:116)
	at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:73)
	at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:323)

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.
Exception in thread "main" org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
	at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:144)
	at 

进程已结束,退出代码1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值