Flink报Input mismatch: Generic type ‘java.lang.Object‘ or a subclass of it expected but was ‘cn.ac.is

问题描述:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.flink.api.java.ClosureCleaner (file:/E:/mavenk/org/apache/flink/flink-core/1.13.0/flink-core-1.13.0.jar) to field java.util.Properties.serialVersionUID
WARNING: Please consider reporting this to the maintainers of org.apache.flink.api.java.ClosureCleaner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: The return type of function 'main(MemUsageMetricsApp.java:48)' could not be determined automatically, due to type erasure. You can give type information hints by using the returns(...) method on the result of the transformation call, or by letting your function implement the 'ResultTypeQueryable' interface.
	at org.apache.flink.api.dag.Transformation.getOutputType(Transformation.java:479)
	at org.apache.flink.streaming.api.datastream.DataStream.addSink(DataStream.java:1236)
	at cn.ac.ist.edr.jobs.metrics.operation.MemUsageMetricsApp.main(MemUsageMetricsApp.java:94)
Caused by: org.apache.flink.api.common.functions.InvalidTypesException: Input mismatch: Generic type 'java.lang.Object' or a subclass of it expected but was 'cn.ac.ist.edr.jobs.common.serialization.elasticsearch.MemoryUserMetric'.
	at org.apache.flink.api.java.typeutils.TypeExtractor.validateInputType(TypeExtractor.java:1423)
	at org.apache.flink.api.java.typeutils.TypeExtractor.getUnaryOperatorReturnType(TypeExtractor.java:571)
	at org.apache.flink.api.java.typeutils.TypeExtractor.getMapReturnTypes(TypeExtractor.java:151)
	at org.apache.flink.streaming.api.datastream.DataStream.map(DataStream.java:576)
	at cn.ac.ist.edr.jobs.metrics.operation.MemUsageMetricsApp.main(MemUsageMetricsApp.java:48)
Caused by: org.apache.flink.api.common.functions.InvalidTypesException: Generic type 'java.lang.Object' or a subclass of it expected but was 'cn.ac.ist.edr.jobs.common.serialization.elasticsearch.MemoryUserMetric'.
	at org.apache.flink.api.java.typeutils.TypeExtractor.validateInfo(TypeExtractor.java:1650)
	at org.apache.flink.api.java.typeutils.TypeExtractor.validateInputType(TypeExtractor.java:1421)
	... 4 more


原因分析:

输出不匹配


解决方案:

在这里插入图片描述
加一个.return(要获取的class对象) 问题即可解决

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值