我试图使用" PutSQL"处理器做到这一点。
我将流文件修改为使用" ReplaceText"并创建一个INSERT
语句。我已经在MySQL数据库中测试了该语句,并且该语句有效。
以下是声明:
INSERT INTO monitor.security_nifi (RemoteIPAddress, Timestamp,RequestUrl, Status, Instance)
VALUES ('10.129.2.35', '2016-09-2016:44:16,347','/secure/Dashboard.jspa', 'PASSED', '35');
当它通过处理器时,我不断收到此错误:
由于java.lang.IndexOutOfBoundsException,无法处理会话: 索引:1,大小:1:java.lang.IndexOutOfBoundsException:索引:1,大小:1
这是堆栈跟踪:
2016-09-21 10:41:24,658 WARN [计时器驱动的进程线程-1] o.a.n.c.t.ContinuallyRunProcessorTask java.lang.IndexOutOfBoundsException:Index:1,Size:1 at java.util.ArrayList.rangeCheck(ArrayList.java:653)〜[na:1.8.0_101] at java.util.ArrayList.get(ArrayList.java:429)〜[na:1.8.0_101] at org.apache.nifi.processors.standard.PutSQL.onTrigger(PutSQL.java:304) 〜[na:na] at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) 〜[nifi-api-1.0.0.jar:1.0.0] at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1064) 〜[nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.0.0.jar:1.0.0] at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent $ 1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.0.0.jar:1.0.0] at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) [na:1.8.0_101] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_101] at java.util.concurrent.ScheduledThreadPoolExecutor中的$ ScheduledFutureTask.access $ 301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_101] at java.util.concurrent.ScheduledThreadPoolExecutor中的$ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]在java.lang.Thread.run(Thread.java:745) [NA:1.8.0_101]
答案 0 :(得分:3)
这看起来像是隐藏实际问题的错误。尝试将PutSQL处理器的“支持分段事务”属性设置为“false”。这应该可以防止Index Out of Bounds Exception,但也可以揭示一个可以纠正的真正问题。如果这是真的(存在另一个问题而且已得到纠正),您可以将属性值恢复为“true”并运行而不会出错。