[
https://issues.apache.org/jira/browse/NIFI-15043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18024576#comment-18024576
]
Jim Steinebrey commented on NIFI-15043:
---------------------------------------
The problem occurs on a clustered NiFi node because it generates a uri to
replicate the request to the other Nifi nodes in the cluster. The uri gets
looks like this:[
*https://redacted:8443/nifi-api/parameter-contexts/null*|https://redacted:8443/nifi-api/parameter-contexts/null]
and gets created on this line:
[https://github.com/jrsteinebrey/nifi/blob/423381d4c53e5765d9a92bebf72804f36294bfa7/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/ParameterUpdateManager.java#L217]
updateUri = new URI(exampleUri.getScheme(),
exampleUri.getUserInfo(), exampleUri.getHost(),
exampleUri.getPort(), "/nifi-api/parameter-contexts/" +
*updatedContext.getId(),* null, exampleUri.getFragment());
The uri has "null" in it because *ParameterContextEntity* *updatedContext* has
a null value for its id instance variable because it never gets set.
ParameterContextEntity which extends ComponentEntity has an instance variable
called parameterContextDTO which stores the actual id. Other subclasses of
ComponentEntity store the id in their inherited instance variable called id.
A robust solution is to make ParameterContextEntity behave consistently with
its siblings (other ContextEntity subclasses) by setting the
ParameterContextEntity id to equal the parameterContextDTO's id which it holds.
> Update Parameter Context Rest API endpoint fails on NiFi cluster, works
> standalone
> ----------------------------------------------------------------------------------
>
> Key: NIFI-15043
> URL: https://issues.apache.org/jira/browse/NIFI-15043
> Project: Apache NiFi
> Issue Type: Bug
> Components: NiFi API
> Affects Versions: 2.6.0
> Reporter: Jim Steinebrey
> Assignee: Jim Steinebrey
> Priority: Major
>
> When I call the NiFI Rest API update parameter context endpoint on a NiFi
> cluster of 3 servers
> /nifi-api/parameter-contexts/ea3df954-b37b-30f6-8947-6130177391c9/update-requests
> I get the exception below and the parameter context is NOT updated.
> When I do the same rest call on a standalone NiFi instance, then the rest
> call successfully updates the parameter context.
> 2025-09-22 16:06:46,574 INFO org.apache.nifi.web.util.ParameterUpdateManager:
> Disabling 0 Controller Services in order to upda
> te Parameter Context
> 2025-09-22 16:06:46,574 INFO org.apache.nifi.web.util.ParameterUpdateManager:
> Updating Parameter Context with ID null
> 2025-09-22 16:06:46,588 ERROR
> org.apache.nifi.web.util.ParameterUpdateManager: Failed to update flow across
> cluster when repli
> cating PUT request to
> [https://redacted:8443/nifi-api/parameter-contexts/null] for user
> identity[redacted]. Received 400 response with explanation:
> The ID of the Parameter Context must be specified
> 2025-09-22 16:06:46,588 INFO org.apache.nifi.web.util.ParameterUpdateManager:
> Re-Enabling 0 Controller Services after having u
> pdated Parameter Context
> 2025-09-22 16:06:46,588 INFO org.apache.nifi.web.util.ParameterUpdateManager:
> Restarting 0 Processors after having updated Par
> ameter Context
> 2025-09-22 16:06:46,588 ERROR
> org.apache.nifi.web.api.ParameterContextResource: Failed to update Parameter
> Context
> org.apache.nifi.web.util.LifecycleManagementException: Failed to update Flow
> on all nodes in cluster due to The ID of the Para
> meter Context must be specified
> at
> org.apache.nifi.web.util.ParameterUpdateManager.performParameterContextUpdate(ParameterUpdateManager.java:201)
> at
> org.apache.nifi.web.util.ParameterUpdateManager.updateParameterContexts(ParameterUpdateManager.java:155)
> at
> org.apache.nifi.web.api.ParameterContextResource.lambda$submitUpdateRequest$17(ParameterContextResource.java:832)
> at
> org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117)
> at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> at java.base/java.lang.Thread.run(Thread.java:840)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)