[ https://issues.apache.org/jira/browse/APEXCORE-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189333#comment-16189333 ]
ASF GitHub Bot commented on APEXCORE-767: ----------------------------------------- florianschmidt1994 opened a new pull request #563: APEXCORE-767.set parent classloader in StramAppLauncher.loadDependencies URL: https://github.com/apache/apex-core/pull/563 Following below is my understanding of the problem (should be probably taken with a grain of salt, as I just started digging in to the apex-core codebase): StramAppLauncher.loadDependencies is called multiple times when starting an application via the apex-cli with the -local option. In each of the calls to loadDependencies, the contextClassLoader of the current thread would be replaced with a new instance of URLClassLoader (which has no parent class loader set). This can lead to issues, e.g. when one acquires the current contextClassLauncher, loads a class with it and tries to cast it to a class which was loaded with a previous instance of the contextClassLoader, resulting in a ClassCastException. An example of this bug can be seen in APEXMALHAR-2511 The changes in this pr fix this by passing the parent class loader for each new instance of URLClassLoader to the current contextClassLoader I am still in the process of figuring how the StramAppLauncher works and why the dependencies get loaded multiple times in the first place, is this intended behavior? Otherwise I could also look into what is going on there as well. (See discussion on JIRA) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Duplicate class loading in CLI for single application launch > ------------------------------------------------------------- > > Key: APEXCORE-767 > URL: https://issues.apache.org/jira/browse/APEXCORE-767 > Project: Apache Apex Core > Issue Type: Bug > Reporter: Thomas Weise > Assignee: Florian Schmidt > > StramAppLauncher will create multiple class loaders in a way that leads to > duplicate loading of the same class (while listing app package, then when > launching). It also appears that the context class loader is never reset. > -- This message was sent by Atlassian JIRA (v6.4.14#64029)