guoweiM commented on a change in pull request #10076: [FLINK-14465][runtime] 
Let `StandaloneJobClusterEntrypoint` use user code class loader
URL: https://github.com/apache/flink/pull/10076#discussion_r343118874
 
 

 ##########
 File path: 
flink-container/src/main/java/org/apache/flink/container/entrypoint/ClassPathJobGraphRetriever.java
 ##########
 @@ -133,9 +138,18 @@ private String getJobClassNameOrScanClassPath() throws 
FlinkException {
        }
 
        private String scanClassPathForJobJar() throws IOException {
-               LOG.info("Scanning class path for job JAR");
-               JarFileWithEntryClass jobJar = 
JarManifestParser.findOnlyEntryClass(jarsOnClassPath.get());
-
+               final JarFileWithEntryClass jobJar;
+               if (getUserClassPaths().isEmpty()) {
+                       LOG.info("Scanning system class path for job JAR");
+                       jobJar = 
JarManifestParser.findOnlyEntryClass(jarsOnClassPath.get());
+               } else {
+                       LOG.info("Scanning user class path for job JAR");
+                       final List<File> userJars = getUserClassPaths()
+                               .stream()
+                               .map(url -> new File(url.getFile()))
+                               .collect(Collectors.toList());
+                       jobJar = JarManifestParser.findOnlyEntryClass(userJars);
+               }
 
 Review comment:
   If the user provides an entrypoint class there is no problem. Because this 
method `scanClassPathForJobJar` would not be called.
   However, if the user does not provide an entrypoint and we need to find an 
entrypoint class there is a problem.
   
   For example:
   
   usrlib/
            |_xxx.jar #no entry point class
   lib/
        |_yyy.jar #entry point class
   
   If we find an entrypoint class from yyy.jar, I assume that this entry point 
class would be load by the parent classloader. This also means that xxx.jar 
would not be loaded in any situation.
   The user configures the `usrlib` and no jar in this directory would be used. 
I think we should avoid this situation and notify the user early.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to