当前位置:   article > 正文

Flink常见异常&解决办法_java.lang.nosuchmethoderror: org.apache.flink.api.

java.lang.nosuchmethoderror: org.apache.flink.api.connector.source.sourcerea

Flink启动报错

Caused by: java.lang.NoSuchMethodError: org.apache.flink.api.common.functions.RuntimeContext.getMetricGroup()Lorg/apache/flink/metrics/groups/OperatorMetricGroup;
	...
	at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:34) ~[flink-dist_2.11-1.13.2.jar:1.13.2]
	at org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:102) ~[flink-dist_2.11-1.13.2.jar:1.13.2]
	at org.apache.flink.streaming.api.operators.ProcessOperator.open(ProcessOperator.java:56) ~[flink-dist_2.11-1.13.2.jar:1.13.2]
	...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Flink版本问题,从1.13.2升级到1.14.6,问题解决~

使用Flink-mysql-cdc启动报错

WARN  org.apache.flink.runtime.taskmanager.Task                    [] - Source: binlog_cdc_input -> input_count_function -> assign_timestamp_watermark -> delete_no_support_kind -> filter_row_column (3/10)#0 (88e9b7b3cd854aec006ec88441da84f2) switched from INITIALIZING to FAILED with failure cause: java.lang.IllegalArgumentException: Subtask ID 2 is out of server id range 1, please adjust the server id range to make the number of server id larger than the source parallelism.
	at com.ververica.cdc.connectors.mysql.source.config.ServerIdRange.getServerId(ServerIdRange.java:56)
	at com.ververica.cdc.connectors.mysql.source.config.MySqlSourceConfigFactory.createConfig(MySqlSourceConfigFactory.java:326)
	at com.ververica.cdc.connectors.mysql.source.config.MySqlSourceConfigFactory.createConfig(MySqlSourceConfigFactory.java:288)
	at com.ververica.cdc.connectors.mysql.source.MySqlSource.createReader(MySqlSource.java:135)
	at org.apache.flink.streaming.api.operators.SourceOperator.initReader(SourceOperator.java:268)
	at org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask.init(SourceOperatorStreamTask.java:70)
	at org.apache.flink.streaming.runtime.tasks.StreamTask.restoreInternal(StreamTask.java:674)
	at org.apache.flink.streaming.runtime.tasks.StreamTask.restore(StreamTask.java:651)
	at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:958)
	at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:927)
	at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:766)
	at org.apache.flink.runtime.taskmanager.Task.run(Task.java:575)
	at java.lang.Thread.run(Thread.java:750)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

是因为给cdc设置的serverId范围过小,导致多个并行度没有足够的serverId分配,导致启动失败!

无法使用旧状态启动任务

Flink版本1.14.6

Caused by: org.apache.flink.util.StateMigrationException: For heap backends, the new state serializer (org.apache.flink.api.common.typeutils.base.ListSerializer@7b317ea3) must not be incompatible with the old state serializer (org.apache.flink.api.common.typeutils.base.ListSerializer@1ba526b7).
	at org.apache.flink.runtime.state.heap.HeapKeyedStateBackend.tryRegisterStateTable(HeapKeyedStateBackend.java:211) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.state.heap.HeapKeyedStateBackend.createInternalState(HeapKeyedStateBackend.java:276) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.state.KeyedStateFactory.createInternalState(KeyedStateFactory.java:47) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.state.ttl.TtlStateFactory.createStateAndWrapWithTtlIfEnabled(TtlStateFactory.java:73) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.state.AbstractKeyedStateBackend.getOrCreateKeyedState(AbstractKeyedStateBackend.java:302) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.getOrCreateKeyedState(StreamOperatorStateHandler.java:316) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.api.operators.AbstractStreamOperator.getOrCreateKeyedState(AbstractStreamOperator.java:471) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.operators.windowing.WindowOperator.open(WindowOperator.java:243) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.tasks.RegularOperatorChain.initializeStateAndOpenOperators(RegularOperatorChain.java:110) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.tasks.StreamTask.restoreGates(StreamTask.java:708) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.tasks.StreamTaskActionExecutor$1.call(StreamTaskActionExecutor.java:55) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.tasks.StreamTask.restoreInternal(StreamTask.java:684) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.streaming.runtime.tasks.StreamTask.restore(StreamTask.java:651) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:958) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:927) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:766) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at org.apache.flink.runtime.taskmanager.Task.run(Task.java:575) ~[flink-dist_2.11-1.14.6.jar:1.14.6]
	at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_345]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  1. 使用无状态启动
  2. 修改任务与原先并行度、执行图保持一致,再启动!

Flink WebUI 指标信息不显示、转圈圈

Flink版本1.18.0

CDC版本:3.0.1

后台报错信息:

Caused by: java.lang.NoSuchMethodError: org.apache.commons.math3.stat.descriptive.rank.Percentile.withNaNStrategy(Lorg/apache/commons/math3/stat/ranking/NaNStrategy;)Lorg/apache/commons/math3/stat/descriptive/rank/Percentile;
  • 1

主要原因:commons-math3版本3.1.1不包含withNaNStrategy 方法

解决办法:升级commons-math3包版本,如果已经存在已经则将原先依赖剔除

 <!--剔除其他应用包中的math3依赖-->
<exclusions>
    <exclusion>
        <artifactId>commons-math3</artifactId>
        <groupId>org.apache.commons</groupId>
    </exclusion>
</exclusions>
 <!--增加math3依赖-->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <version>3.6.1</version>
</dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/528427
推荐阅读
相关标签
  

闽ICP备14008679号