Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Error with TaskSearchFilter using Java APIs in custom component

Avatar

Former Community Member

I have created a custom Java component for use in LC Process Mgr.

Upon invoke of process containing component, component fails with the following message:

2011-02-28 16:28:31,260 ERROR [com.adobe.workflow.AWS] Cannot coerce object: com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter@cf7e441 of type: com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter to type: class com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter

Code is pretty basic:

        ServiceClientFactory myFactory = ServiceClientFactory.createInstance();

        TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(myFactory);

        TaskSearchFilter filter = new TaskSearchFilter();
        filter.addCondition(TaskSearchingConstants.pSTATUS, Operator.EQUALS, "3");
       
        List<TaskRow> result = queryManager.taskSearch(filter);

Error seems to occur with the creation of the List. This code works ok when run as standalone file in either Eclipse or Netbeans but not within the component.

All necessary JARs are included and are listed in the class-path in component.xml.

Does anyone have any ideas?

Thanks,

David

1 Accepted Solution

Avatar

Correct answer by
Level 8

Looks like a class loader issue.  Usually this is caused by having the a class (TaskSearchFilte) in your component that on the server.   In other words there are two copies of the TaskSearchFilte class - yours and the one already in LiveCycle - and they are in conflict.

If that's the case, the solution is simple:

  • remove the jar files containing the TaskSearchFilte (and any other LiveCycle clients) from your component's jar file.  You may need them in the build path, so your code can compile - but you don't need them in the final component jar.
  • remove the references to these jar files from the component.xml file's class-path entry
  • add an import-packages section to your component.xml file.  This will not reference the jar files, but the package names themselves.  For example:

<import-packages>    

     <package version="1.0">com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter</package>

     <!--  add more as needed -->

</import-packages>

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

Looks like a class loader issue.  Usually this is caused by having the a class (TaskSearchFilte) in your component that on the server.   In other words there are two copies of the TaskSearchFilte class - yours and the one already in LiveCycle - and they are in conflict.

If that's the case, the solution is simple:

  • remove the jar files containing the TaskSearchFilte (and any other LiveCycle clients) from your component's jar file.  You may need them in the build path, so your code can compile - but you don't need them in the final component jar.
  • remove the references to these jar files from the component.xml file's class-path entry
  • add an import-packages section to your component.xml file.  This will not reference the jar files, but the package names themselves.  For example:

<import-packages>    

     <package version="1.0">com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter</package>

     <!--  add more as needed -->

</import-packages>

Avatar

Former Community Member

Hodmi,

Thank you for your help. Your suggestion worked correctly, and the component is running well.

I removed the taskmanager-client.jar from the library and added a reference to it in the buildpath. Also added the reference to the package in the component.xml within the import-packages.

I appreciate your help with this issue.

Cheers!

David