Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Unable to run NIFI CLI "nifi" subcommands, "registry" works fine

avatar
New Contributor

I'm able to run cli.sh registry commands, but not cli.sh nifi commands for some reason. They're both secured and use the same props files (except for different baseurls) as defined in ~/.nifi-cli.config:

$ cat ~/.nifi-cli.config 
nifi.reg.props=/appl/nifi-registry/nifi-registry-current/conf/cli-props
nifi.props=/appl/nifi/nifi-current/conf/cli-props
$ ./bin/cli.sh registry list-buckets

#   Name             Id                                     Description   
-   --------------   ------------------------------------   -----------   
1   abc              87959437-dfbf-4fa2-9a4d-c0509afaff17   (empty)       
2   def              4864d2de-0af5-4a69-a584-d88c108b774f   (empty)       
3   ghi              20f8069e-60bb-437b-ac3a-f949ffa4582b   (empty) 

But nifi commands fail:

 

$ ./bin/cli.sh nifi current-user

ERROR: Error executing command 'current-user' : Error retrieving current
$ ./bin/cli.sh nifi current-user -verbose

ERROR: Error executing command 'current-user' : Error retrieving current


org.apache.nifi.toolkit.cli.api.CommandException: Error executing command 'current-user' : Error retrieving current
	at org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand.doExecute(AbstractNiFiCommand.java:52)
	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:251)
	at org.apache.nifi.toolkit.cli.impl.command.CommandProcessor.processGroupCommand(CommandProcessor.java:232)
	at org.apache.nifi.toolkit.cli.impl.command.CommandProcessor.process(CommandProcessor.java:187)
	at org.apache.nifi.toolkit.cli.CLIMain.runSingleCommand(CLIMain.java:145)
	at org.apache.nifi.toolkit.cli.CLIMain.main(CLIMain.java:72)
Caused by: org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException: Error retrieving current
	at org.apache.nifi.toolkit.cli.impl.client.nifi.impl.AbstractJerseyClient.executeAction(AbstractJerseyClient.java:85)
	at org.apache.nifi.toolkit.cli.impl.client.nifi.impl.JerseyFlowClient.getCurrentUser(JerseyFlowClient.java:67)
	at org.apache.nifi.toolkit.cli.impl.command.nifi.flow.CurrentUser.doExecute(CurrentUser.java:48)
	at org.apache.nifi.toolkit.cli.impl.command.nifi.flow.CurrentUser.doExecute(CurrentUser.java:32)
	at org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand.doExecute(AbstractNiFiCommand.java:50)
	... 6 more
Caused by: javax.ws.rs.client.ResponseProcessingException: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=utf-8, type=class org.apache.nifi.web.api.entity.CurrentUserEntity, genericType=class org.apache.nifi.web.api.entity.CurrentUserEntity.
	at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:875)
	at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:428)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:324)
	at org.apache.nifi.toolkit.cli.impl.client.nifi.impl.JerseyFlowClient.lambda$getCurrentUser$0(JerseyFlowClient.java:69)
	at org.apache.nifi.toolkit.cli.impl.client.nifi.impl.AbstractJerseyClient.executeAction(AbstractJerseyClient.java:71)
	... 10 more
Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html;charset=utf-8, type=class org.apache.nifi.web.api.entity.CurrentUserEntity, genericType=class org.apache.nifi.web.api.entity.CurrentUserEntity.
	at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:232)
	at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)
	at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:808)
	at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:321)
	at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:870)
	... 20 more

Does anyone have any idea what's going on? Happy to provide more debugging output.

I'm running Nifi 1.9.2 and Nifi-Registry 0.5.0.

1 ACCEPTED SOLUTION

avatar
New Contributor

Yeah, my bad, I didn't want to break it again after fixing it, but I can see there'd be value in documenting this.

 

In my case, I saw the following error popping up in my `nifi-app.log` when trying to run bin/cli.sh nifi current-user:

 

WARN [NiFi Web Server-363] o.a.nifi.web.server.HostHeaderHandler Request host header [example.com] different from web hostname [127.0.0.1(:8444)]. Overriding to [127.0.0.1:8444/nifi-api/flow/current-user]

 

So what I did was add example.com to the nifi.web.proxy.host config, which fixed the issue for me.

 

It would be really helpful if the error message in that case would state the error more clearly. The current error looks like the CLI isn't handling the response correctly, although it's actually a server error. So I guess the CLI is in fact not handling the response properly.

 

(Unrelated: It'd be nice to be able to insert <code> tags to make this more readable. They're currently being stripped when you press "Post")

🙂

View solution in original post

4 REPLIES 4

avatar
New Contributor

My bad, apparently. I found errors in logs that made it clear that this was a bad configuration.

avatar
Community Manager

@JTT Can you provide some additional details on what what configured incorrectly and how you corrected it? It may be useful to others who face a similar issue in the future. 


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
New Contributor

Yeah, my bad, I didn't want to break it again after fixing it, but I can see there'd be value in documenting this.

 

In my case, I saw the following error popping up in my `nifi-app.log` when trying to run bin/cli.sh nifi current-user:

 

WARN [NiFi Web Server-363] o.a.nifi.web.server.HostHeaderHandler Request host header [example.com] different from web hostname [127.0.0.1(:8444)]. Overriding to [127.0.0.1:8444/nifi-api/flow/current-user]

 

So what I did was add example.com to the nifi.web.proxy.host config, which fixed the issue for me.

 

It would be really helpful if the error message in that case would state the error more clearly. The current error looks like the CLI isn't handling the response correctly, although it's actually a server error. So I guess the CLI is in fact not handling the response properly.

 

(Unrelated: It'd be nice to be able to insert <code> tags to make this more readable. They're currently being stripped when you press "Post")

🙂

avatar
Community Manager

Thanks for sharing @JTT. As for entering code, you do have the option to add a code sample in the post editor. 

 

Screen Shot 2020-02-07 at 4.55.10 PM.png

 

This will open a pop-up to enter the code.

 

Screen Shot 2020-02-07 at 4.57.09 PM.png

 

The final result looks like this ( I anonymized the IP addresses):

WARN [NiFi Web Server-363] o.a.nifi.web.server.HostHeaderHandler Request host header [example.com] different from web hostname [xxx.x.x.x(:xxxx)]. Overriding to [xxx.x.x.x:xxxx/nifi-api/flow/current-user]

 

While you cannot use this to format words in a sentence, it is helpful for large samples. I hope it helps. 


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.