Reputation: 31
NiFi throws an error in the JOLT processor - although the test inside the "advanced" processor interface works flawlessly!
Some flowfiles are converted without error - the majority however fail - eg:
JSON:
{
"abc": {
"HEADER": {
"A": "WDD2132041A2213962",
"B": "75268508"
},
"BODY": {
"C": "OK",
"D": "1"
},
"ABCDEFG": "Time[s] | X | Y | Z | A/B [%] | X/Y [%] "
}
}
JOLT:
[
{
"operation": "shift",
"spec": {
"abc": {
"HEADER": { "*": "&" },
"SUMMARY": { "*": "&" },
"*": { "$": "ITEM", "@": "VAL" }
}
}
}
]
Did anyone run into this kind of error before?
2017-03-24 15:12:35,765 ERROR [Timer-Driven Process Thread-6] o.a.n.p.standard.JoltTransformJSON
java.lang.RuntimeException: Unable to load JSON object from InputStream.
at com.bazaarvoice.jolt.JsonUtilImpl.jsonToObject(JsonUtilImpl.java:105) ~[json-utils-0.0.21.jar:0.0.21]
at com.bazaarvoice.jolt.JsonUtils.jsonToObject(JsonUtils.java:117) ~[json-utils-0.0.21.jar:0.0.21]
at org.apache.nifi.processors.standard.JoltTransformJSON.onTrigger(JoltTransformJSON.java:244) ~[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_77]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_77]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_77]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.ArrayIndexOutOfBoundsException) (through reference chain: java.util.LinkedHashMap["xml"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase.wrapAndThrow(ContainerDeserializerBase.java:88) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.java:507) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:341) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize(UntypedObjectDeserializer.java:220) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3702) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2784) ~[jackson-databind-2.6.1.jar:2.6.1]
at com.bazaarvoice.jolt.JsonUtilImpl.jsonToObject(JsonUtilImpl.java:102) ~[json-utils-0.0.21.jar:0.0.21]
... 14 common frames omitted
Upvotes: 0
Views: 2021
Reputation: 41
Like mattyb I tried this as well and was also unable to reproduce (using the latest source). If you are able to capture failed content and post , along with the NiFi version you are using, I may be able to at least recreate the problem and investigate from there.
Upvotes: 1
Reputation: 12103
I was unable to reproduce, but I am using the latest source code (which will at some point become NiFi 1.2.0) which has an upgrade of the Jolt library as well as some changes to the JoltTransformJSON processor. I pasted in the JSON above and the spec, and it converted fine.
Is the JSON being passed to JoltTransformJSON using a character set other than the Java default (often UTF-8)? If so, try a ConvertCharacterSet processor before the JoltTransformJSON processor.
Upvotes: 2