[jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620807#comment-16620807 ] Imre edited comment on NIFI-4685 at 9/19/18 9:44 PM: - So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: {{C:\Program Files\My Program\nifi-conf\}}... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} was (Author: olajos): So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: {{C:\Program Files\My Program\nifi-conf\}}... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} > 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 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 (v7.6.3#76005)
[jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620807#comment-16620807 ] Imre edited comment on NIFI-4685 at 9/19/18 4:22 PM: - So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: {{C:\Program Files\My Program\nifi-conf\}}... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} was (Author: olajos): So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: \{{C:\Program Files\My Program\nifi-conf\}} ... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} > 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 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 (v7.6.3#76005)
[jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620807#comment-16620807 ] Imre edited comment on NIFI-4685 at 9/19/18 4:22 PM: - So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: \{{C:\Program Files\My Program\nifi-conf\}}... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} was (Author: olajos): So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} > 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 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 (v7.6.3#76005)
[jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620807#comment-16620807 ] Imre edited comment on NIFI-4685 at 9/19/18 4:22 PM: - So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: \{{C:\Program Files\My Program\nifi-conf\}} ... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} was (Author: olajos): So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory: \{{C:\Program Files\My Program\nifi-conf\}}... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} > 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 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 (v7.6.3#76005)
[jira] [Commented] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620807#comment-16620807 ] Imre commented on NIFI-4685: So, looking at the source, in my case starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also does not work, because {{/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java}} makes the assumption that the second up parent dir of the bootstrap config file will be the root (the "workingDir") of all things NiFi. Which in my case is also not true, as I'm putting the configuration files in a different directory... {{public void start() throws IOException, InterruptedException {}} {{...}} {{final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();}} {{final File binDir = bootstrapConfigAbsoluteFile.getParentFile();}} {{final File workingDir = binDir.getParentFile();}} {{...}} {{}}} > 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 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 (v7.6.3#76005)
***UNCHECKED*** [jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620727#comment-16620727 ] Imre edited comment on NIFI-4685 at 9/19/18 3:53 PM: - I just bumped into the same issue (NiFi v1.7.1). In my case, running on Windows, I created my own batch file to start NiFi, with the lib directory of NiFi being installed in {{c:\Program Files\NiFi}}, and all generated files (logs, internal DB, etc.) pointed to {{C:\ProgramData\NiFi}}. (I modified several NiFi config files to achieve this.) I happened to start the batch file from somewhere other than the NiFi root dir in {{C:\Program Files\NiFi}}, and I got the following exception (due to the above code): {{2018-09-19 09:30:25,895 INFO [main] org.apache.nifi.NiFi Launching NiFi...}} {{2018-09-19 09:30:25,906 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.nio.file.NoSuchFileException: lib\bootstrap}} {{java.nio.file.NoSuchFileException: lib\bootstrap}} {{at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)}} {{at sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)}} {{at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)}} {{at java.nio.file.Files.newDirectoryStream(Files.java:457)}} {{at java.nio.file.Files.list(Files.java:3451)}} {{at org.apache.nifi.NiFi.createBootstrapClassLoader(NiFi.java:197)}} {{at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:299)}} {{at org.apache.nifi.NiFi.main(NiFi.java:291)}} Although, interestingly, starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also results in the same exception, even though there's definitely a {{lib\bootstrap}} directory there relative to the current dir... was (Author: olajos): I just bumped into the same issue (NiFi v1.7.1). In my case, running on Windows, I created my own batch file to start NiFi, with the lib directory of NiFi being installed in {{c:\Program Files\NiFi}}, and all generated files (logs, internal DB, etc.) pointed to {{C:\ProgramData\NiFi}}. (I modified several NiFi config files to achieve this.) I happened to start the batch file from somewhere other than the NiFi root dir in {{C:\Program Files\NiFi}}, and I got the following exception (due to the above code): {{2018-09-19 09:30:25,895 INFO [main] org.apache.nifi.NiFi Launching NiFi...}} {{2018-09-19 09:30:25,906 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.nio.file.NoSuchFileException: lib\bootstrap}} {{java.nio.file.NoSuchFileException: lib\bootstrap}} {{at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)}} {{at sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)}} {{at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)}} {{at java.nio.file.Files.newDirectoryStream(Files.java:457)}} {{at java.nio.file.Files.list(Files.java:3451)}} {{at org.apache.nifi.NiFi.createBootstrapClassLoader(NiFi.java:197)}} {{at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:299)}} {{at org.apache.nifi.NiFi.main(NiFi.java:291)}} Although, interestingly, starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also results in the same exception, even though there's definitely a {{lib\bootstrapper}} directory there relative to the current dir... > 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 urls = new ArrayList<>(); > Files.list(Paths.get({color:red}_"lib/bootstrap"_{color})).forEach(p > -> { >
[jira] [Comment Edited] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620727#comment-16620727 ] Imre edited comment on NIFI-4685 at 9/19/18 3:53 PM: - I just bumped into the same issue (NiFi v1.7.1). In my case, running on Windows, I created my own batch file to start NiFi, with the lib directory of NiFi being installed in {{c:\Program Files\NiFi}}, and all generated files (logs, internal DB, etc.) pointed to {{C:\ProgramData\NiFi}}. (I modified several NiFi config files to achieve this.) I happened to start the batch file from somewhere other than the NiFi root dir in {{C:\Program Files\NiFi}}, and I got the following exception (due to the above code): {{2018-09-19 09:30:25,895 INFO [main] org.apache.nifi.NiFi Launching NiFi...}} {{2018-09-19 09:30:25,906 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.nio.file.NoSuchFileException: lib\bootstrap}} {{java.nio.file.NoSuchFileException: lib\bootstrap}} {{at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)}} {{at sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)}} {{at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)}} {{at java.nio.file.Files.newDirectoryStream(Files.java:457)}} {{at java.nio.file.Files.list(Files.java:3451)}} {{at org.apache.nifi.NiFi.createBootstrapClassLoader(NiFi.java:197)}} {{at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:299)}} {{at org.apache.nifi.NiFi.main(NiFi.java:291)}} Although, interestingly, starting Java on the command-line from the {{C:\Program Files\NiFi}} directory also results in the same exception, even though there's definitely a {{lib\bootstrapper}} directory there relative to the current dir... was (Author: olajos): I just bumped into the same issue. In my case, I'm running on Windows, I created my own batch file to start NiFi, with the lib directory of NiFi being installed in {{c:\Program Files\NiFi}}, and all generated files (logs, internal DB, etc.) pointed to {{C:\ProgramData\NiFi}}. I happened to start the batch file from somewhere other than the NiFi root dir in {{C:\Program Files\NiFi}}, and I got the following exception (due to the above code): {{2018-09-19 09:30:25,895 INFO [main] org.apache.nifi.NiFi Launching NiFi...}} {{2018-09-19 09:30:25,906 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.nio.file.NoSuchFileException: lib\bootstrap}} {{java.nio.file.NoSuchFileException: lib\bootstrap}} {{at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)}} {{at sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)}} {{at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)}} {{at java.nio.file.Files.newDirectoryStream(Files.java:457)}} {{at java.nio.file.Files.list(Files.java:3451)}} {{at org.apache.nifi.NiFi.createBootstrapClassLoader(NiFi.java:197)}} {{at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:299)}} {{at org.apache.nifi.NiFi.main(NiFi.java:291)}} > 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 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(
[jira] [Commented] (NIFI-4685) Hardcoded path when creating Bootstrap ClassLoader in Nifi
[ https://issues.apache.org/jira/browse/NIFI-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620727#comment-16620727 ] Imre commented on NIFI-4685: I just bumped into the same issue. In my case, I'm running on Windows, I created my own batch file to start NiFi, with the lib directory of NiFi being installed in {{c:\Program Files\NiFi}}, and all generated files (logs, internal DB, etc.) pointed to {{C:\ProgramData\NiFi}}. I happened to start the batch file from somewhere other than the NiFi root dir in {{C:\Program Files\NiFi}}, and I got the following exception (due to the above code): {{2018-09-19 09:30:25,895 INFO [main] org.apache.nifi.NiFi Launching NiFi...}} {{2018-09-19 09:30:25,906 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.nio.file.NoSuchFileException: lib\bootstrap}} {{java.nio.file.NoSuchFileException: lib\bootstrap}} {{at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)}} {{at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)}} {{at sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)}} {{at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)}} {{at java.nio.file.Files.newDirectoryStream(Files.java:457)}} {{at java.nio.file.Files.list(Files.java:3451)}} {{at org.apache.nifi.NiFi.createBootstrapClassLoader(NiFi.java:197)}} {{at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:299)}} {{at org.apache.nifi.NiFi.main(NiFi.java:291)}} > 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 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 (v7.6.3#76005)