Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-13676

NIFI CLI import-all-flows fails with certain flows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0-M4
    • None
    • None
    • None
    • Official Docker Images 2.0.0-M4 (NiFi, NiFi Registry, NiFi Toolkit) running on Ubuntu 22.04.4 LTS and Docker v27.0.3

    Description

      This ticket concerns the bin/cli.sh nifi registry export-all-flows and import-all-flows commands as described in https://issues.apache.org/jira/browse/NIFI-11327 and 2.0.0-M4 documentation.

      My objective is to provision new NiFi Registries deployed on on-premises servers with flows that are continuously maintained, improved, and exported from a centralized NiFi Registry.

      However, when attempting to import all of my flows (a total of 10 relatively simple flows), which were freshly exported using the export-all-flows command, into a new NiFi Registry instance (with a new database and flow storage), the following exception is encountered:

      $ bin/cli.sh registry import-all-flows -u "http://nifi-registry:18080" --input "${NIFI_HOME}/imported_flows" --verbose
      ERROR: Error executing command 'import-all-flows' : Cannot invoke "String.startsWith(String)" because the return value of "org.apache.nifi.flow.VersionedFlowCoordinates.getStorageLocation()" is null
      
      org.apache.nifi.toolkit.cli.api.CommandException: Error executing command 'import-all-flows' : Cannot invoke "String.startsWith(String)" because the return value of "org.apache.nifi.flow.VersionedFlowCoordinates.getStorageLocation()" is null	at org.apache.nifi.toolkit.cli.impl.command.registry.AbstractNiFiRegistryCommand.doExecute(AbstractNiFiRegistryCommand.java:58)	at org.apache.nifi.toolkit.cli.impl.command.AbstractPropertyCommand.execute(AbstractPropertyCommand.java:74)	at org.apache.nifi.toolkit.cli.impl.command.CommandProcessor.processCommand(CommandProcessor.java:248)	at org.apache.nifi.toolkit.cli.impl.command.CommandProcessor.processGroupCommand(CommandProcessor.java:229)	at org.apache.nifi.toolkit.cli.impl.command.CommandProcessor.process(CommandProcessor.java:184)	at org.apache.nifi.toolkit.cli.CLIMain.runSingleCommand(CLIMain.java:145)	at org.apache.nifi.toolkit.cli.CLIMain.main(CLIMain.java:72)Caused by: java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because the return value of "org.apache.nifi.flow.VersionedFlowCoordinates.getStorageLocation()" is null	at org.apache.nifi.toolkit.cli.impl.command.registry.flow.ImportAllFlows.updateStorageLocation(ImportAllFlows.java:270)	at org.apache.nifi.toolkit.cli.impl.command.registry.flow.ImportAllFlows.updateStorageLocation(ImportAllFlows.java:278)	at org.apache.nifi.toolkit.cli.impl.command.registry.flow.ImportAllFlows.doExecute(ImportAllFlows.java:167)	at org.apache.nifi.toolkit.cli.impl.command.registry.flow.ImportAllFlows.doExecute(ImportAllFlows.java:57)	at org.apache.nifi.toolkit.cli.impl.command.registry.AbstractNiFiRegistryCommand.doExecute(AbstractNiFiRegistryCommand.java:56)	... 6 more 

      I've attempted to import my flows using the NiFi Toolkit across all my NiFi containers (NiFi, NiFi Registry, NiFi Toolkit), but I consistently encounter this exception.

      After extensive testing, I've observed that the error occurs only with some of my flows. I initially suspected that embedded Processor Groups might be the issue, so I tried renaming my buckets and flows to ensure the embedded Processor Groups appear first in the file list, but this didn't resolve the problem. 

      Here is a screenshot from my latest test involving two flows, one of which contains the other. I’ve attached the JSON definitions to this ticket to help you reproduce the issue. As you can see, the first flow imports correctly, but the second one shows no version.

      My tests also included switching databases from H2 to MySQL, but this didn't make any difference.

      When manually using the "Import New Flow" feature in the NiFi Registry UI, everything works smoothly, even when the flow contains an embedded Processor Group that hasn't been imported yet.

      I'm currently exploring workarounds using other NiFi Toolkit commands to fully automate this process.

      I haven't tested with other versions, as I'm exclusively working with the latest 2.0.0-M4 release.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              julz Julien Ledoux
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: