2 Replies Latest reply on Mar 2, 2011 7:13 AM by DavidWoodyTodd

    Error with TaskSearchFilter using Java APIs in custom component


      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?



        • 1. Re: Error with TaskSearchFilter using Java APIs in custom component
          Hodmi Level 4

          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:


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

               <!--  add more as needed -->


          • 2. Re: Error with TaskSearchFilter using Java APIs in custom component
            DavidWoodyTodd Level 1



            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.