Julien Ledoux created NIFI-13676:
------------------------------------
Summary: NIFI CLI import-all-flows fails with certain flows
Key: NIFI-13676
URL: https://issues.apache.org/jira/browse/NIFI-13676
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 2.0.0-M4
Environment: Official Docker Images 2.0.0-M4 (NiFi, NiFi Registry,
NiFi Toolkit) running on Ubuntu 22.04.4 LTS and Docker v27.0.3
Reporter: Julien Ledoux
Attachments: Screenshot from 2024-08-23 15-07-50.png,
toolkit_registry_export_all_00 Embedded flows_Recursive UNZIP_1,
toolkit_registry_export_all_PAI Examples_Example usage of recursive UNZIP_1
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:
{code:java}
$ 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 {code}
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.
!Screenshot from 2024-08-23 15-07-50.png|width=564,height=397!
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)