[
https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sorin Florea updated NIFI-4685:
-------------------------------
Description:
Found a hardcoded path to {{lib/bootstrap}} in
[org.apache.nifi.NiFi|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java#L3]
class when calling {{createBootstrapClassLoader()}} :
{code:java}
private static ClassLoader createBootstrapClassLoader() throws IOException {
//Get list of files in bootstrap folder
final List<URL> urls = new ArrayList<>();
Files.list(Paths.get({color:red}_"lib/bootstrap"_{color})).forEach(p ->
{
try {
urls.add(p.toUri().toURL());
} catch (final MalformedURLException mef) {
LOGGER.warn("Unable to load " + p.getFileName() + " due to " +
mef, mef);
}
});
//Create the bootstrap classloader
return new URLClassLoader(urls.toArray(new URL[0]),
Thread.currentThread().getContextClassLoader());
}
{code}
There are multiple places where the {{.\lib}} directory is defined:
* {{BOOTSTRAP_LIBS}} or {{%LIB_DIR%}} environment variables in {{nifi.sh}} or
{{run-nifi.bat}}
* {{lib.dir}} in {{bootstrap.conf}} is most likely it
* {{nifi.nar.library.directory}} or {{nifi.web.war.directory}} identify the
library folder but don't quite refer to the bootstrap
Perhaps using {{lib.dir}} in {{bootstrap.conf}} or create a new
{{lib.bootstrap.dir}} property.
Using different library folders would allow configuring multiple instances of
Nifi using the same resource. I managed changing the properties and environment
variables above to point to a common {{lib}} directory but this harcoded
prevented {{run-nifi.bat}} to run successfully. {{dump-nifi.bat}} and
{{status-nifi.bat}} ran without issue.
was:
Found a hardcoded path to {{"lib/bootstrap"}} in [link
{{org.apache.nifi.NiFi}}|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java#L3]
class when calling {{createBootstrapClassLoader()}} :
{code:java}
private static ClassLoader createBootstrapClassLoader() throws IOException {
//Get list of files in bootstrap folder
final List<URL> urls = new ArrayList<>();
Files.list(Paths.get({color:red}_"lib/bootstrap"_{color})).forEach(p ->
{
try {
urls.add(p.toUri().toURL());
} catch (final MalformedURLException mef) {
LOGGER.warn("Unable to load " + p.getFileName() + " due to " +
mef, mef);
}
});
//Create the bootstrap classloader
return new URLClassLoader(urls.toArray(new URL[0]),
Thread.currentThread().getContextClassLoader());
}
{code}
There are multiple places where the {{.\lib}} directory is defined:
* {{BOOTSTRAP_LIBS}} or {{%LIB_DIR%}} environment variables in {{nifi.sh}} or
{{run-nifi.bat}}
* {{lib.dir}} in {{bootstrap.conf}} is most likely it
* {{nifi.nar.library.directory}} or {{nifi.web.war.directory}} identify the
library folder but don't quite refer to the bootstrap
Perhaps using {{lib.dir}} in {{bootstrap.conf}} or create a new
{{lib.bootstrap.dir}} property.
Using different library folders would allow configuring multiple instances of
Nifi using the same resource. I managed changing the properties and environment
variables above to point to a common {{lib}} directory but this harcoded
prevented {{run-nifi.bat}} to run successfully. {{dump-nifi.bat}} and
{{status-nifi.bat}} ran without issue.
> Hardcoded path when creating Bootstrap ClassLoader in Nifi
> ----------------------------------------------------------
>
> Key: NIFI-4685
> URL: https://issues.apache.org/jira/browse/NIFI-4685
> Project: Apache NiFi
> Issue Type: Bug
> Components: Configuration, Core Framework
> Affects Versions: 1.4.0
> Environment: Windows 7, JRE 1.8.0_144
> Reporter: Sorin Florea
> Priority: Minor
> Labels: easyfix, usability, windows
>
> Found a hardcoded path to {{lib/bootstrap}} in
> [org.apache.nifi.NiFi|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java#L3]
> class when calling {{createBootstrapClassLoader()}} :
> {code:java}
> private static ClassLoader createBootstrapClassLoader() throws IOException {
> //Get list of files in bootstrap folder
> final List<URL> urls = new ArrayList<>();
> Files.list(Paths.get({color:red}_"lib/bootstrap"_{color})).forEach(p
> -> {
> try {
> urls.add(p.toUri().toURL());
> } catch (final MalformedURLException mef) {
> LOGGER.warn("Unable to load " + p.getFileName() + " due to "
> + mef, mef);
> }
> });
> //Create the bootstrap classloader
> return new URLClassLoader(urls.toArray(new URL[0]),
> Thread.currentThread().getContextClassLoader());
> }
> {code}
> There are multiple places where the {{.\lib}} directory is defined:
> * {{BOOTSTRAP_LIBS}} or {{%LIB_DIR%}} environment variables in {{nifi.sh}} or
> {{run-nifi.bat}}
> * {{lib.dir}} in {{bootstrap.conf}} is most likely it
> * {{nifi.nar.library.directory}} or {{nifi.web.war.directory}} identify the
> library folder but don't quite refer to the bootstrap
> Perhaps using {{lib.dir}} in {{bootstrap.conf}} or create a new
> {{lib.bootstrap.dir}} property.
> Using different library folders would allow configuring multiple instances of
> Nifi using the same resource. I managed changing the properties and
> environment variables above to point to a common {{lib}} directory but this
> harcoded prevented {{run-nifi.bat}} to run successfully. {{dump-nifi.bat}}
> and {{status-nifi.bat}} ran without issue.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)