CHANDAN KUMAR created NIFI-14627:
------------------------------------

             Summary: NiFi service failed to start with 
FlowSerializationException :Could not par se flow as a VersionedDataflow
                 Key: NIFI-14627
                 URL: https://issues.apache.org/jira/browse/NIFI-14627
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 1.28.0, 1.23.0
            Reporter: CHANDAN KUMAR


This Jira is created to report BUG where 
NiFi service failing to start due to a corrupted flow.json due to an empty 
template present in the flow.json

The flow contains an invalid (empty) template that causes NullPointerException 
when parsing the flow json.

Stack :
{code:java}
ERROR org.apache.nifi.web.server.JettyServer: Failed to start Flow Service
org.apache.nifi.controller.serialization.FlowSerializationException: Could not 
parse flow as a VersionedDataflow
        at 
org.apache.nifi.cluster.protocol.StandardDataFlow.parseVersionedDataflow(StandardDataFlow.java:167)
        at 
org.apache.nifi.cluster.protocol.StandardDataFlow.getVersionedDataflow(StandardDataFlow.java:108)
        at 
org.apache.nifi.controller.serialization.VersionedFlowSynchronizer.mapCompatibleBundles(VersionedFlowSynchronizer.java:237)
        at 
org.apache.nifi.controller.serialization.VersionedFlowSynchronizer.sync(VersionedFlowSynchronizer.java:169)
        at 
org.apache.nifi.controller.serialization.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:42)
        at 
org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1530)
        at 
org.apache.nifi.persistence.StandardFlowConfigurationDAO.load(StandardFlowConfigurationDAO.java:104)
        at 
org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:817)
        at 
org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:457)
        at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:940)
        at org.apache.nifi.NiFi.<init>(NiFi.java:172)
        at org.apache.nifi.NiFi.<init>(NiFi.java:83)
        at org.apache.nifi.NiFi.main(NiFi.java:332)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: N/A
 at [Source: 
(byte[])"{"encodingVersion":{"majorVersion":2,"minorVersion":0},"maxTimerDrivenThreadCount":256,"maxEventDrivenThreadCount":1,"registries":[],"parameterContext
s":[{"identifier":"XXXXXXXXXXXXXXXX","instanceIdentifier":"XXXXXXXXXXXXXXX","name":"cem","parameters":[{"name":"cem.prod.dir","desc
ription":"","sensitive":false,"provided":false,"value":"/path"},{"name":"","description":"","sensitive":
false,"[truncated 71886960 bytes]; line: 1, column: 1043154] (through reference 
chain: 
org.apache.nifi.controller.flow.VersionedDataflow["templates"]->java.util.HashSet[4]-
>org.apache.nifi.controller.flow.VersionedTemplate["templateDto"]->org.apache.nifi.web.api.dto.TemplateDTO["snippet"]->org.apache.nifi.web.api.dto.FlowSnippetDTO["processor
s"])
        at 
com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:276)
        at 
com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:630)
        at 
com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:618)



Caused by: java.lang.NullPointerException: null  at 
org.apache.nifi.web.api.dto.FlowSnippetDTO$1.compare(FlowSnippetDTO.java:199) 
at 
org.apache.nifi.web.api.dto.FlowSnippetDTO$1.compare(FlowSnippetDTO.java:196) 
at java.base/java.util.TreeMap.compare(TreeMap.java:1292) at 
java.base/java.util.TreeMap.put(TreeMap.java:536) at 
java.base/java.util.TreeSet.add(TreeSet.java:255) at 
java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:352) at 
java.base/java.util.TreeSet.addAll(TreeSet.java:312) at 
org.apache.nifi.web.api.dto.FlowSnippetDTO.orderedById(FlowSnippetDTO.java:202) 
at 
org.apache.nifi.web.api.dto.FlowSnippetDTO.setProcessors(FlowSnippetDTO.java:162){code}
 
Corrupt template:
  
{code:java}
53530     {
  53531       "identifier": "XXXXXXXXXXXXXXXXXXXXXX",
  53532       "instanceIdentifier": "XXXXXX-XXXXX-XXXXX-XXXXX-XXXXXXX",
  53533       "name": "KafkaToRedisTemplate",
  53534       "templateDto": {
  53535         "id": "XXXXXXXX-defb-3d5a-9de1-XXXXXXXX",
  53536         "name": "KTemplate",
  53537         "description": "Consume JSON from Kafka and storeXYZ.",
  53538         "timestamp": "04/16/2025 22:06:04 GMT",
  53539         "snippet": {
  53540           "processGroups": [],
  53541           "remoteProcessGroups": [],
  53542           "processors": [
  53543             {
  53544               "config": {
  53545                 "properties": {}
  53546               }
  53547             }
  53548           ],
  53549           "inputPorts": [],
  53550           "outputPorts": [],
  53551           "connections": [],
  53552           "labels": [],
  53553           "funnels": [],
  53554           "controllerServices": []
  53555         }
  53556       },
  53557       "componentType": "TEMPLATE",
  53558       "groupIdentifier": "ZXXXXXXX-0196-1000-XXXXX-XXXXXXXX"
  53559     },{code}
I feel between flow.xml and flow.json transition there is some issue resulting 
templated being corrupted as I would Not believe that one would upload an empty 
template in NIFI

Solution : Remove the problematic template from flow.json and use updated 
flow.json.gz to start the service

Though templates and flow.xml are limited to NiFi 1.X but worth reporting

Thank you



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to