9 Replies Latest reply on Feb 25, 2009 6:05 AM by Hodmi

    building customize component using java API

    Level 1
      Hi,

      Appreciate for hepls... being trying this for few days...:(

      I am trying to build a customize component to use in a process using adobe java API. I follow the document and include all the necessary lib files. It compiled with no errors. And I pack it into JAR file and deploy to the workbench, no error. Then I call the customized component method and it throw the error as below, is merely cause by "Caused by: java.lang.NoClassDefFoundError: com.adobe.idp.taskmanager.dsc.client.TaskManagerClientFactory
      ". Portion of my code is as follow.

      What did I miss out? I include the libs file as stated in the document. Do I need to specify the class-path in a manifest file? How? It is not mentioned in the document. Is the "adobe-taskmanager-client-sdk.jar" pack in one of the ear or war file in the App server's (I'm using websphere) installedApp directory?

      Really appreciate for help... Is there any documents describing the deployment details. The sdk document is not very detail...

      === portion of the code ===

      Properties ConnectionProps = new Properties();
      ConnectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "iiop://localhost:2809");
      ConnectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");
      ConnectionProps.setProperty("DSC_SERVER_TYPE", "WebSphere");
      ConnectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
      ConnectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");

      //Create a ServiceClientFactory object
      ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);

      TaskManagerQueryService queryProcess = TaskManagerClientFactory.getQueryManager(myFactory);

      ...

      ======Error message=====

      ALC-DSC-003-000: com.adobe.idp.dsc.DSCInvocationException: Invocation error.
      at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:210)
      at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:134)
      at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
      at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)
      at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:336)
      at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Ej bTransactionCMTAdapterBean.java:212)
      at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doSupports(Unknown Source)
      at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:104)
      at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)
      at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
      at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)
      at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
      at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:88)
      at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:44)
      at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:113)
      at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:102)
      at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:88)
      at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:21 0)
      at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:57)
      at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
      at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:553)
      at com.adobe.workflo
        • 1. Re: building customize component using java API
          Level 1
          I do'nt think you have to use the login credentials when you are deploying the component, use the following
          ServiceClientFactory myFactory = ServiceClientFactory.createInstance();
          Only when you are running the component outside of the container you would create a ServiceClientFactory by passing in a connection Properties, atleast that is how I do it and it has worked
          let me know if it does'nt
          • 2. Re: building customize component using java API
            Level 1
            Also if you are getting noClassDedFound error, you may need to export the packages in your component.xml file
            <component xmlns="http://adobe.com/idp/dsc/component/document">
            <!-- Unique id identifying this DSC -->
            <component-id>TaskAttachments</component-id>
            <import-packages>
            <package>com.adobe.idp.taskmanager.dsc.client</package>
            <package>com.adobe.idp.taskmanager.dsc.client.task</package>
            <package>com.adobe.idp.taskmanager.dsc.client.task</package>
            <package>com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceClient</packa ge>
            </import-packages>
            <export-packages>
            <package>com.adobe.idp.taskmanager.dsc.client</package>
            <package>com.adobe.idp.taskmanager.dsc.client.task</package>
            <package>com.adobe.idp.taskmanager.dsc.client.task</package>
            <package>com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceClient</packa ge>
            </export-packages>
            <!-- Version -->
            <version>1.0</version>
            <!-- Start of the Service definition -->
            • 3. Re: building customize component using java API
              Level 1
              Thanks WorkflowUser,
              I manage to solve the NoClassDefFound problem in any other way. Will try your method.

              What I do is I add the adobe-taskmanager-client-sdk.jar file to my customize component jar file (at root). And I add the classpath tag for the adobe-taskmanager-client-sdk.jar to the component.xml file. But when the customise component is run at a process. Another problem occured. I got an exception "com.adobe.idp.taskmanager.dsc.client.query.TaskRowImpl incompatible with com.adobe.idp.taskmanager.dsc.client.query.TaskRow".

              It is cause by the following code,
              TaskManager myTaskManager = TaskManagerClientFactory.getTaskManager(myFactory);
              TaskFilter filter = queryProcess.newTaskFilter();
              StatusFilter sf = filter.newStatusFilter();
              sf.addStatus(StatusFilter.completed);
              filter.setStatusFiltering(sf);
              List result = queryProcess.taskList(filter);
              Iterator iter = result.iterator();
              int i = 0 ;
              while (iter.hasNext()) {
              TaskRow myTask = (TaskRow)iter.next(); //CAUSE BY THIS!!!
              long taskId = myTask.getTaskId();

              I try using this: TaskRowImpl myTask = (TaskRowImpl)iter.next();
              also give exception error. Does it have to do with the compilation, the java version. My websphere is runing 1.5, and I compile using the same version... Any ideal? Thanks...
              • 4. Re: building customize component using java API
                HowardTreisman Level 1
                I'd try the import tag in component.xml.
                Also, NoClassDefFound can also sometimes mean that you've built using the wrong version of java.
                Good luck..
                Howard
                http://www.avoka.com
                • 5. Re: building customize component using java API
                  Dear Mike,

                  How did you manage to solve the ClassCast Exception?

                  Regards,
                  Nadir Maroof
                  • 6. Re: building customize component using java API
                    Level 1
                    I mean the "com.adobe.idp.taskmanager.dsc.client.query.TaskRowImpl incompatible with com.adobe.idp.taskmanager.dsc.client.query.TaskRow" problem
                    • 7. Re: building customize component using java API
                      Level 1
                      Try running the code from a standalone Java application. Once you know whether the code works in a standalone application, put it in a component. You do not need to include LC JAR files in your component's JAR file. As explained in the docs:

                      It is recommended that you include only the JAR files that are required to run the Java application logic located in your component. That is, if a JAR file is not required by your component, do not include it in the component JAR file. Although you must include adobe-livecycle-client.jar in your projects class path to use a com.adobe.idp.Document object in your application logic, it is not necessary to include this JAR file in the component JAR file because this data type is already part of the service container.
                      • 8. Re: building customize component using java API
                        Level 1
                        Hi Scott,

                        That is what i did. I tried running the component standalone and it is working perfectly fine. All the required JARS are included and they are working fine as standalone.

                        Regards
                        Nadir Maroof
                        • 9. Re: building customize component using java API
                          Hodmi Level 4
                          It sounds like you may be getting a class loader conflict. Try not including the Adobe LiveCycle jars in your package (they are already on the server).  Instead modify your component.xml to include the Adobe classes in the <dynamic-import-packages> tag.