问题描述:
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对象) 问题即可解决