You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/09/20 17:02:29 UTC

[GitHub] [pinot] mayankshriv commented on a change in pull request #7400: Fix classpath with plugins java 8

mayankshriv commented on a change in pull request #7400:
URL: https://github.com/apache/pinot/pull/7400#discussion_r712354124



##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/plugin/PluginClassLoader.java
##########
@@ -31,27 +32,53 @@
 public class PluginClassLoader extends URLClassLoader {
 
   private final ClassLoader _classLoader;
+  private Method _addUrlMethod = null;
 
   public PluginClassLoader(URL[] urls, ClassLoader parent) {
     super(urls, parent);
     _classLoader = PluginClassLoader.class.getClassLoader();
+    
+    /**
+     * ClassLoader in java9+ does not extend URLClassLoader.
+     * If the class is not found in the parent classloader,
+     * it will be found in this classloader via findClass().
+     *
+     * @see https://bit.ly/2WROm1s
+     */
+
+    if (_classLoader instanceof URLClassLoader) {
+      try {
+        _addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
+      } catch (NoSuchMethodException e) {
+        //this should never happen
+        ExceptionUtils.rethrow(e);
+      }
+      
+      _addUrlMethod.setAccessible(true);

Review comment:
       Any alternative suggestion @richardstartin? Seems like the issue surfaced in Pinot 0.8.0 and is breaking spark ingestion job.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org