Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Error when sending data to API from NiFi

Error when sending data to API from NiFi

Rising Star

I am attempting to sent a POST request to a PowerBI web API. I am using InvokeHTTP processor, and it is sending data (PowerBI is receiving the data).

However, every flowfile is routed to Failure with the following error:

2017-06-08 14:01:37,368 ERROR Timer-Driven Process Thread-232 - o.a.nifi.processors.standard.InvokeHTTP 
org.apache.nifi.processor.exception.FlowFileAccessException: Failed to import data from buffer(okio.GzipSource@252df454).inputStream() for StandardFlowFileRecord[uuid=85bfdcdc-e0d6-41f9-8492-1d71e5732e10,claim=,offset=0,name=1963726412837939,size=0] due to org.apache.nifi.processor.exception.FlowFileAccessException: Unable to create ContentClaim due to java.io.EOFException
	at org.apache.nifi.controller.repository.StandardProcessSession.importFrom(StandardProcessSession.java:2690) ~[na:na]
	at org.apache.nifi.processors.standard.InvokeHTTP.onTrigger(InvokeHTTP.java:700) ~[nifi-standard-processors-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) [nifi-api-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1099) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_91]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_91]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_91]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_91]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: org.apache.nifi.processor.exception.FlowFileAccessException: Unable to create ContentClaim due to java.io.EOFException
	at org.apache.nifi.controller.repository.StandardProcessSession.importFrom(StandardProcessSession.java:2683) ~[na:na]
	... 13 common frames omitted
Caused by: java.io.EOFException: null
	at okio.RealBufferedSource.require(RealBufferedSource.java:64) ~[okio-1.6.0.jar:na]
	at okio.GzipSource.consumeHeader(GzipSource.java:114) ~[okio-1.6.0.jar:na]
	at okio.GzipSource.read(GzipSource.java:73) ~[okio-1.6.0.jar:na]
	at okio.RealBufferedSource$1.read(RealBufferedSource.java:371) ~[okio-1.6.0.jar:na]
	at java.io.InputStream.read(InputStream.java:101) ~[na:1.8.0_91]
	at org.apache.nifi.stream.io.StreamUtils.copy(StreamUtils.java:35) ~[nifi-utils-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
	at org.apache.nifi.controller.repository.FileSystemRepository.importFrom(FileSystemRepository.java:700) ~[na:na]
	at org.apache.nifi.controller.repository.StandardProcessSession.importFrom(StandardProcessSession.java:2680) ~[na:na]
	... 13 common frames omitted 

Any idea what would cause this exception, and how to fix it?

4 REPLIES 4

Re: Error when sending data to API from NiFi

Expert Contributor

@Benjamin Hopp Post response might not in be valid format and could be causing the issue.

Re: Error when sending data to API from NiFi

Its trying to read the response from the POST in order to write it to the content of the flow file, but its getting an End-Of-File exception. The response seems to be expecting gzip compression which expects a 10 byte header, and its throwing the exception because 10 bytes don't exist.

Re: Error when sending data to API from NiFi

Rising Star

Is there a work around for this? I have no way of controlling the response headers, and the flowfile is being terminated after transmission. Currently it is just filling the nifi-app.log with unnecessary errors.

Re: Error when sending data to API from NiFi

I think the problem is the client used by NiFi thinks the response should be GZIP'd, but the service isn't returning a GZIP'd response.

Can you edit nifi_home/conf/logback.xml and turn on debug logging for InvokeHttp by adding:

<logger name="org.apache.nifi.processors.standard.InvokeHTTP" level="DEBUG"/>

Then wait 30 seconds and run some data through the processor and look in nifi-app.log for something like:

Response from remote service

After that line there should be a list of all the headers from the response, and if you could paste them here that would be helpful for debugging this.

Don't have an account?
Coming from Hortonworks? Activate your account here