Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.

4,980 views
Skip to first unread message

Gopan Sugathan

unread,
Mar 24, 2014, 4:47:04 AM3/24/14
to camunda-...@googlegroups.com
Hi,


I am trying to assign a task to three people using a subprocess dynamically.

I used a multi instance loop in a subprocess and used an execution listener to create a collection of the users who we wanted to assign the task

Everything works fine and we able to see the task getting assigned.
However when I try to work on the task and press the complete task button we are getting the following error .Has anyone faced this error or is it something to do with the way I am modeling .The generated bpmn looks like this 

  <bpmn2:process id="loan-approval" isExecutable="true">
    <bpmn2:endEvent id="EndEvent_2">
      <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:startEvent id="StartEvent_2">
      <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:subProcess id="SubProcess_2">
      <bpmn2:extensionElements>
        <camunda:executionListener class="com.camunda.user.assignment.UserAssignement" event="start"/>
      </bpmn2:extensionElements>
      <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
      <bpmn2:multiInstanceLoopCharacteristics camunda:collection="assigneeList" camunda:elementVariable="assignee"/>
      <bpmn2:startEvent id="StartEvent_1">
        <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
      </bpmn2:startEvent>
      <bpmn2:userTask id="UserTask_1" camunda:assignee="${assignee}" camunda:formKey="embedded:app:forms/approve-loan.html" name="Approve Loan">
        <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
      </bpmn2:userTask>
      <bpmn2:endEvent id="EndEvent_1">
        <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
      </bpmn2:endEvent>
      <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="UserTask_1"/>
      <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="UserTask_1" targetRef="EndEvent_1"/>
    </bpmn2:subProcess>
    <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="StartEvent_2" targetRef="SubProcess_2"/>
    <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="SubProcess_2" targetRef="EndEvent_2"/>
  </bpmn2:process>



Mar 24, 2014 2:06:00 PM org.camunda.bpm.engine.rest.exception.RestExceptionHandler toResponse
WARNING: org.camunda.bpm.engine.rest.exception.RestException: Cannot submit task form de712046-b32e-11e3-ba5e-40f02f573f97: Process engine persistence exception
at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.submit(TaskResourceImpl.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.camunda.bpm.webapp.impl.security.filter.SecurityFilter.doFilterSecure(SecurityFilter.java:67)
at org.camunda.bpm.webapp.impl.security.filter.SecurityFilter.doFilter(SecurityFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter$1.execute(AuthenticationFilter.java:59)
at org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter$1.execute(AuthenticationFilter.java:56)
at org.camunda.bpm.webapp.impl.security.SecurityActions.runWithAuthentications(SecurityActions.java:38)
at org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter.doFilter(AuthenticationFilter.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.camunda.bpm.engine.ProcessEngineException: Process engine persistence exception
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:196)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.FormServiceImpl.submitTaskForm(FormServiceImpl.java:82)
at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.submit(TaskResourceImpl.java:93)
... 47 more
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.HistoricDetailEntity.insertHistoricFormPropertyEvent-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, ACT_INST_ID_, EXECUTION_ID_, TASK_ID_, TIME_, NAME_, TEXT_)     values (       ?,       'FormProperty',       ?,       ?,       ?,       ?,       ?,       ?,       ?     )
### Cause: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)
at org.camunda.bpm.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:675)
at org.camunda.bpm.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:495)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:214)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:157)
... 51 more
Caused by: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1936)
at org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:36)
at org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:47)
at org.apache.ibatis.type.ObjectTypeHandler.setNonNullParameter(ObjectTypeHandler.java:28)
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:46)
at org.apache.ibatis.type.UnknownTypeHandler.setNonNullParameter(UnknownTypeHandler.java:37)
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:46)
at org.apache.ibatis.executor.parameter.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:91)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:77)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:58)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:71)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:44)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)
... 56 more

Daniel Meyer

unread,
Mar 25, 2014, 8:37:21 AM3/25/14
to camunda-...@googlegroups.com
Hi Gopan,

could you provide the source code of the form? embedded:app:forms/approve-loan.html

Thanks,
Daniel

Gopan Sugathan

unread,
Mar 26, 2014, 12:42:24 AM3/26/14
to camunda-...@googlegroups.com
Hi Daniel,


The source code for your reference.I found a work around for this problem.The user were being returned as collection and set as variable using setVariable.I changed set Variable to setVariableLocal and the problem no longer exists

public class UserAssignement implements ExecutionListener {
public static List<String> getLabTechnicians()  {
return Arrays.asList("john", "mary", "peter");

}

public void notify(DelegateExecution execution) throws Exception {
System.out.println("Inside excution Listeners");

execution.setVariableLocal("assigneeList", getLabTechnicians());
System.out.println("Existing  excution Listeners");
}



<form class="form-horizontal">
      <div class="control-group">
        <label class="control-label">Customer ID</label>
        <div class="controls">
          <input form-field type="string" name="customerId" readonly="true" />
        </div>
      </div>
      <div class="control-group">
        <label class="control-label">Amount</label>
        <div class="controls">
          <input form-field type="number" name="amount" />
        </div>
      </div>
    </form>


--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/NgWs3vcLMVg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/386e64ef-6433-4cdc-8b99-4823c9e39965%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages