Hi, 按照你给出的部分代码,看不出问题所在,按道理是不应该的
建议给出更详细的信息,可以考虑以下几个方面
1. 完整可复现的代码(可以放到附件中),方便其他同学复现问题
2. 具体使用版本

PS: 如果你确认不是你测试环境/代码的问题,甚至可以直接建 jira issue 来反馈 bug,参见
https://flink.apache.org/how-to-contribute.html#file-a-bug-report


天边的云 <[email protected]> 于2019年4月3日周三 下午3:24写道:

> 如题,按照官方例子
> env9.registerCachedFile("hdfs://xxx/key", "key");
>
>
> ...
> .map(
>     new RichMapFunction<String, String>() {
>       @Override
>       public String map(String value) throws Exception {
>         return value;
>       }
>       @Override
>       public void open(Configuration parameters) {
>        File file =
> getRuntimeContext().getDistributedCache().getFile("key");
>             System.out.println(file.getAbsolutePath());
>       }
>
>
>     });
> ...
> 之前1.5版本没有任何问题,相同的代码更换到1.7.1版本之后报如下错误:
> java.lang.IllegalArgumentException: File with name 'key' is not available.
> Did you forget to register the file?
>
>
> 有谁遇到相同的问题或对这块代码有研究的吗?

回复