You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "victor.jiang (Jira)" <ji...@apache.org> on 2020/04/03 05:05:00 UTC

[jira] [Commented] (FLINK-16794) ClassNotFoundException caused by ClassLoader.getSystemClassLoader using impertinently

    [ https://issues.apache.org/jira/browse/FLINK-16794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17074280#comment-17074280 ] 

victor.jiang commented on FLINK-16794:
--------------------------------------

Hi Till Rohrmann,

In our application scenario for flink-client usage, we create a customized ClassLoader for loading flink dependent jars, in order to avoid the conflict with our app's jars.

For the improvement , pls fix it.

> ClassNotFoundException caused by ClassLoader.getSystemClassLoader using impertinently  
> ---------------------------------------------------------------------------------------
>
>                 Key: FLINK-16794
>                 URL: https://issues.apache.org/jira/browse/FLINK-16794
>             Project: Flink
>          Issue Type: Improvement
>          Components: Client / Job Submission, Runtime / REST
>    Affects Versions: 1.8.0, 1.8.1, 1.8.2, 1.8.3
>            Reporter: victor.jiang
>            Priority: Major
>
> In some containerization environment,the context classloader is not the SystemClassLoader,it uses the customized classloader usually for the classes isolation ,so the ClassNotFoundException may be caused。recommends using getClass/Caller/ThreadCurrentContext 's ClassLoader。
> The related sources below:
> 1.flink-clients\src\main\java\org\apache\flink\client\program\ClusterClient.java"(690,33): return getAccumulators(jobID, ClassLoader.getSystemClassLoader());
>  2.flink-clients\src\main\java\org\apache\flink\client\program\MiniClusterClient.java"(148,33): return getAccumulators(jobID, ClassLoader.getSystemClassLoader());
>  3.flink-runtime\src\main\java\org\apache\flink\runtime\blob\BlobUtils.java"(348,66): return (Throwable) InstantiationUtil.deserializeObject(bytes, ClassLoader.getSystemClassLoader());
>  4.flink-runtime\src\main\java\org\apache\flink\runtime\rest\messages\json\SerializedThrowableDeserializer.java"(52,68): return InstantiationUtil.deserializeObject(serializedException, ClassLoader.getSystemClassLoader());
>  5.flink-runtime\src\main\java\org\apache\flink\runtime\rpc\messages\RemoteRpcInvocation.java"(118,67): methodInvocation = serializedMethodInvocation.deserializeValue(ClassLoader.getSystemClassLoader());



--
This message was sent by Atlassian Jira
(v8.3.4#803005)