Support Questions

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

PutSQL error: java.lang.String cannot be cast to oracle.sql.CLOB

avatar
Contributor

Hello All,

I am passing sql.args.1.type = 2005 and sql.args.1.value as a CLOB value to PutSQL and it is throwing below error. How do I resolve this error?

2017-09-04 10:17:24,924 INFO [StandardProcessScheduler Thread-5] o.a.n.c.s.TimerDrivenSchedulingAgent Scheduled PutSQL[id=69534f73-821e-1782-ffff-fffffabb94fb] to run with 1 threads
2017-09-04 10:17:25,009 ERROR [Timer-Driven Process Thread-4] o.apache.nifi.processors.standard.PutSQL PutSQL[id=69534f73-821e-1782-ffff-fffffabb94fb] org.apache.nifi.processors.standard.PutSQL$$Lambda$653/696434096@771333e failed to process due to org.apache.nifi.processor.exception.ProcessException: Failed to process StandardFlowFileRecord[uuid=14895cdd-3eac-4f2a-adae-f014526e24b1,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1502123289026-125, container=default, section=125], offset=71441, length=39],offset=0,name=5936554321553480,size=39] due to java.lang.ClassCastException: java.lang.String cannot be cast to oracle.sql.CLOB; rolling back session: {}
org.apache.nifi.processor.exception.ProcessException: Failed to process StandardFlowFileRecord[uuid=14895cdd-3eac-4f2a-adae-f014526e24b1,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1502123289026-125, container=default, section=125], offset=71441, length=39],offset=0,name=5936554321553480,size=39] due to java.lang.ClassCastException: java.lang.String cannot be cast to oracle.sql.CLOB
at org.apache.nifi.processor.util.pattern.ExceptionHandler.lambda$createOnGroupError$14(ExceptionHandler.java:226)
at org.apache.nifi.processor.util.pattern.ExceptionHandler.lambda$createOnError$13(ExceptionHandler.java:179)
at org.apache.nifi.processor.util.pattern.ExceptionHandler$OnError.lambda$andThen$11(ExceptionHandler.java:54)
at org.apache.nifi.processor.util.pattern.ExceptionHandler$OnError.lambda$andThen$11(ExceptionHandler.java:54)
at org.apache.nifi.processor.util.pattern.ExceptionHandler.execute(ExceptionHandler.java:148)
at org.apache.nifi.processors.standard.PutSQL.lambda$new$72(PutSQL.java:283)
at org.apache.nifi.processors.standard.PutSQL.lambda$new$75(PutSQL.java:324)
at org.apache.nifi.processor.util.pattern.PutGroup.putFlowFiles(PutGroup.java:91)
at org.apache.nifi.processor.util.pattern.Put.onTrigger(Put.java:101)
at org.apache.nifi.processors.standard.PutSQL.lambda$onTrigger$86(PutSQL.java:544)
at org.apache.nifi.processor.util.pattern.PartialFunctions.onTrigger(PartialFunctions.java:114)
at org.apache.nifi.processor.util.pattern.RollbackOnFailure.onTrigger(RollbackOnFailure.java:184)
at org.apache.nifi.processors.standard.PutSQL.onTrigger(PutSQL.java:544)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to oracle.sql.CLOB
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8874)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8396)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8980)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:242)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at org.apache.nifi.processors.standard.PutSQL.setParameter(PutSQL.java:888)
at org.apache.nifi.processors.standard.PutSQL.setParameters(PutSQL.java:677)
at org.apache.nifi.processors.standard.PutSQL.lambda$null$71(PutSQL.java:285)
at org.apache.nifi.processor.util.pattern.ExceptionHandler.execute(ExceptionHandler.java:127)
... 19 common frames omitted

1 REPLY 1

avatar
Contributor
Hello All, Logged https://issues.apache.org/jira/browse/NIFI-4352 for this issue. Thanks!!