机器学习PAI的alink任务在本地运行好好的,上传到flink web运行就报这个错误。怎么解决?org.apache.flink.runtime.rest.handler.RestHandlerException: Could not execute application. at org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$1(JarRunHandler.java:110) at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:836) at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:811) at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1609) at java.lang.Thread.run(Thread.java:750) Caused by: java.util.concurrent.CompletionException: org.apache.flink.util.FlinkRuntimeException: Could not execute application. at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273) at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1606) … 1 more Caused by: org.apache.flink.util.FlinkRuntimeException: Could not execute application. at org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:88) at org.apache.flink.client.deployment.application.DetachedApplicationRunner.run(DetachedApplicationRunner.java:70) at org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$0(JarRunHandler.java:104) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604) … 1 more Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Failed to collect ops data. at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372) at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222) at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114) at org.apache.flink.client.deployment.application.DetachedApplicationRunner.tryExecuteJobs(DetachedApplicationRunner.java:84) … 4 more Caused by: ERROR: 0x0860080000001003-Flink execution error: Failed to collect ops data. at com.alibaba.alink.operator.batch.BatchOperator.triggerLazyEvaluation(BatchOperator.java:709) at com.alibaba.alink.operator.batch.BatchOperator.triggerLazyEvaluation(BatchOperator.java:689) at com.alibaba.alink.operator.batch.BatchOperator.print(BatchOperator.java:441) at com.alibaba.alink.operator.batch.BatchOperator.print(BatchOperator.java:436) at com.alibaba.alink.operator.batch.BatchOperator.print(BatchOperator.java:428) at com.xiaoai.StreamxAlinkMain.main(StreamxAlinkMain.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355) … 7 more Caused by: org.apache.flink.util.FlinkRuntimeException: Cannot have more than one execute() or executeAsync() call in a single environment. at org.apache.flink.client.program.ContextEnvironment.validateAllowedExecution(ContextEnvironment.java:142) at org.apache.flink.client.program.ContextEnvironment.executeAsync(ContextEnvironment.java:130) at org.apache.flink.client.program.ContextEnvironment.execute(ContextEnvironment.java:70) at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:942) at com.alibaba.alink.operator.batch.BatchOperator.collect(BatchOperator.java:749) at com.alibaba.alink.operator.batch.BatchOperator.triggerLazyEvaluation(BatchOperator.java:704) … 17 more
以下为热心网友提供的参考意见
这个错误信息是由 Apache Flink 框架抛出的,指示在执行 Flink 程序时遇到了问题。错误信息中包含了多个异常堆栈,说明了错误发生的位置和原因。从提供的堆栈跟踪信息中,我们可以看到以下几个关键点:
最初的异常是org.apache.flink.runtime.rest.handler.RestHandlerException,表明在处理 REST 请求时发生了错误。
异常的根因是org.apache.flink.util.FlinkRuntimeException,错误信息为:”Could not execute application.”,即无法执行应用程序。
该异常引起了org.apache.flink.client.program.ProgramInvocationException,它指出程序的主方法发生了错误,错误信息为:”Failed to collect ops data.”,即收集操作数据失败。
最后,org.apache.flink.util.FlinkRuntimeException指出了具体的问题:”Cannot have more than one execute() or executeAsync() call in a single environment.”,这意味着在同一个环境中不能有多于一个的execute()或executeAsync()调用。
要解决这个问题,您需要检查您的 Flink 程序代码。错误提示您在代码中可能有多个execute()或executeAsync()调用,这是不允许的。Flink 程序应该只有一个execute()调用来启动作业的执行。如果您的程序中确实有多个这样的调用,您需要重构代码,以确保只有一个调用。
此外,错误信息还提到了com.alibaba.alink.operator.batch.BatchOperator,表明您使用的是 Alibaba 的 Alink 库。您应该查看您的StreamxAlinkMain类中main方法的第55行,那里可能是引起问题的代码位置。
总的来说,您需要:
检查 Flink 程序中的execute()或executeAsync()调用,确保整个程序中只有一次调用。
审查您的main方法,特别是在报告错误的行周围的代码。
如果您在使用BatchOperator进行操作,确保您没有在不同的地方触发作业执行。
如果问题持续存在,可能需要进一步调试或查看更详细的日志来确定问题的根源。
最后,如果您对 Flink 不太熟悉,也可以考虑查阅相关文档或向社区寻求帮助,以获得更具体的解决方案。此回答整理自钉群“Alink开源–用户群”
本文来自投稿,不代表新手站长_郑州云淘科技有限公司立场,如若转载,请注明出处:https://www.cnzhanzhang.com/10681.html