-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
-
False
-
---
-
---
Following the guide from kogito in a serverless workflow case, an exception was thrown as below.
2023-01-12 16:56:13,167 ERROR [org.kie.kog.add.qua.mes.com.AbstractQuarkusCloudEventReceiver] (kogito-event-executor-1) Error processing message {"specversion":"0.3","id":"0367994e-5c60-4129-9290-1f2daea0448b","source":"adc","type":"newDataProcessing","time":"2022-12-27T07:09:24.057146288Z","procid":"1023","data":{ "input": { "uploadId":"abc","userId":"def","jobId":"mno" }}}: java.util.concurrent.CompletionException: java.lang.RuntimeException: Error finding process instance dedf980b-e0d5-48e4-b09c-4559ef665b37
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Error finding process instance dedf980b-e0d5-48e4-b09c-4559ef665b37
at org.kie.kogito.persistence.jdbc.Repository.uncheckedException(Repository.java:53)
at org.kie.kogito.persistence.jdbc.GenericRepository.findByIdInternal(GenericRepository.java:172)
at org.kie.kogito.persistence.jdbc.JDBCProcessInstances.findById(JDBCProcessInstances.java:107)
at org.kie.kogito.process.ProcessInstances.findById(ProcessInstances.java:24)
at org.kie.kogito.event.impl.ProcessEventDispatcher.handleMessageWithReference(ProcessEventDispatcher.java:113)
at org.kie.kogito.event.impl.ProcessEventDispatcher.lambda$dispatch$0(ProcessEventDispatcher.java:72)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
... 3 more
Caused by: org.postgresql.util.PSQLException: ERROR: trailing junk after parameter at or near "$2a"
Position: 79
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)
at io.agroal.pool.wrapper.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:78)
at org.kie.kogito.persistence.jdbc.GenericRepository.findByIdInternal(GenericRepository.java:161)
After debugging, an invalid usage of function sqlIncludingVersion was found.
private static String sqlIncludingVersion(String statement, String processVersion) { return statement + (processVersion == null ? PROCESS_VERSION_IS_NULL : PROCESS_VERSION_EQUALS_TO); }
As the statement is something like 'SELECT payload, version FROM process_instances WHERE process_id = ? and id = ?' without a blank, the result of this function is 'SELECT payload, version FROM process_instances WHERE process_id = ? and id = ?and process_version = ?' and it is an invalid sql statement.