Issue
When you use the API in LiveCycle ES to call the method, “TaskManagerQueryService.taskSearch(TaskSearchFilter filter),” the following exception may occur:
ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter@1972b9a of type: com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter to type: class com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter at com.adobe.idp.dsc.util.CoercionUtil.toType(CoercionUtil.java:1047) at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:127) at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74) at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTransactionCMTAdapterBean.java:342) at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(EjbTransactionCMTAdapterBean.java:212) at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapter_z73hg_ELOImpl.doSupports
Solution
- Make sure that the processId object passed into the filter.addCondition() is a valid object.
- Verify that the libraries you are importing contain no abstract references to classes with similar names and make sure that they are the latest versions.
Additional Information
Here is the code which would generate the error message above (or download here):
____________________________
ServiceClientFactory factory = ServiceClientFactory.createInstance(context);
TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(factory);
TaskManager taskManager = TaskManagerClientFactory.getTaskManager(factory);
TaskSearchFilter filter = new TaskSearchFilter();
filter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_ID, Operator.EQUALS, processId);
filter.addSortAsc(TaskSearchingConstants.pPROCESS_START_TIME);
// To look on every task !!! Need to have an Administrator context!!!
filter.setAdminIgnoreAllAcls(true);
List<TaskRow> result = queryManager.taskSearch(filter);
____________________________
reference: (181492707)
