Return-Path: X-Original-To: apmail-apex-dev-archive@minotaur.apache.org Delivered-To: apmail-apex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4091D1831E for ; Tue, 26 Jan 2016 17:35:42 +0000 (UTC) Received: (qmail 58084 invoked by uid 500); 26 Jan 2016 17:35:42 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 58023 invoked by uid 500); 26 Jan 2016 17:35:42 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 58011 invoked by uid 99); 26 Jan 2016 17:35:42 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jan 2016 17:35:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8E488C2416 for ; Tue, 26 Jan 2016 17:35:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.78 X-Spam-Level: * X-Spam-Status: No, score=1.78 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 3wlFVUmBA9jx for ; Tue, 26 Jan 2016 17:35:41 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 8FC9C42BC5 for ; Tue, 26 Jan 2016 17:35:40 +0000 (UTC) Received: (qmail 57973 invoked by uid 99); 26 Jan 2016 17:35:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jan 2016 17:35:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id EBEF82C1F5B for ; Tue, 26 Jan 2016 17:35:39 +0000 (UTC) Date: Tue, 26 Jan 2016 17:35:39 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@apex.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (APEXCORE-304) Ability to add jars to classpath in populateDAG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/APEXCORE-304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15117610#comment-15117610 ] ASF GitHub Bot commented on APEXCORE-304: ----------------------------------------- Github user vrozov commented on a diff in the pull request: https://github.com/apache/incubator-apex-core/pull/208#discussion_r50869794 --- Diff: engine/src/main/java/com/datatorrent/stram/StramLocalCluster.java --- @@ -318,6 +333,21 @@ public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundExcep } } + private void addExtraJarsToClasspath(Set jars) + throws InvocationTargetException, IllegalAccessException, MalformedURLException, NoSuchMethodException + { + List jarUrls = new LinkedList<>(); + for (String jarPath : jars) { + File file = new File(jarPath); + URL url = file.toURI().toURL(); + jarUrls.add(url); + } + + ClassLoader prevCl = Thread.currentThread().getContextClassLoader(); + ClassLoader urlCl = URLClassLoader.newInstance(jarUrls.toArray(new URL[jarUrls.size()]), prevCl); + Thread.currentThread().setContextClassLoader(urlCl); --- End diff -- Please provide unit test(s) that exercise adding custom jars to classpath and loads custom classes using both Class.forName() and context ClassLoader. As long as context ClassLoader is used to load all custom classes it should work, but I don't see how it will for with the current ClassLoader if operators or modules use Class.forName(). > Ability to add jars to classpath in populateDAG > ----------------------------------------------- > > Key: APEXCORE-304 > URL: https://issues.apache.org/jira/browse/APEXCORE-304 > Project: Apache Apex Core > Issue Type: Improvement > Reporter: Chinmay Kolhatkar > Assignee: Chinmay Kolhatkar > > This will have following functionality: > 1) In populateDAG one would be allowed to add given local jar path to classpath of the application. > 2) Optionally delete the given jar file after copying to HDFS is done. -- This message was sent by Atlassian JIRA (v6.3.4#6332)