1 2 Previous Next 20 Replies Latest reply on Mar 17, 2014 5:03 AM by Prateek Mehra

    JBPM 6 exception while trying to start a process using API

    Prateek Mehra Newbie

      I created a simple process using the jbpm console (JBPM 6.0.0) which has some user tasks. I wanted to try out controlling the process using the API so created a simple web application and used the following code to start the process that I made in the jbpm console:

       

       

      String deploymentId = "IncidentManagement";

        String url = "http://localhost:8080/jbpm-console/";

        URL baseURL = new URL(url);

        String user = "krisv";

        String password = "krisv";

        long procId = 0;

       

       

        try {

        RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory(

        deploymentId, baseURL, user, password);

        RuntimeEngine engine = restSessionFactory.newRuntimeEngine();

        KieSession ksession = engine.getKieSession();

        ProcessInstance processInstance = ksession

        .startProcess("IncidentManagement.IncidentManagementProces");

        log.info("process instance: " + processInstance);

        if (processInstance != null) {

        procId = processInstance.getId();

        log.info("process id: " + procId);

        }

       

       

        } catch (Exception e) {

        e.printStackTrace();

        }

       

       

      However I get the error below:

       

       

      13:42:32,796 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) java.lang.UnsupportedOperationException: Unsupported JAXB Class during initialization: 2 counts of IllegalAnnotationExceptions

       

       

       

       

      13:42:32,802 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.JaxbSerializationProvider.initializeJaxbContext(JaxbSerializationProvider.java:78)

       

       

       

       

      13:42:32,807 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.JaxbSerializationProvider.<init>(JaxbSerializationProvider.java:71)

       

       

       

       

      13:42:32,811 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.api.command.RemoteConfiguration.getJaxbSerializationProvider(RemoteConfiguration.java:395)

       

       

       

       

      13:42:32,815 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.api.command.AbstractRemoteCommandObject.executeRestCommand(AbstractRemoteCommandObject.java:310)

       

       

       

       

      13:42:32,819 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.api.command.AbstractRemoteCommandObject.execute(AbstractRemoteCommandObject.java:110)

       

       

       

       

      13:42:32,824 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:232)

       

       

       

       

      13:42:32,827 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)

       

       

       

       

      13:42:32,832 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at projectx.incidentmgmt.IncidentMgmt.doGet(IncidentMgmt.java:53)

       

       

       

       

      13:42:32,835 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

       

       

       

       

      13:42:32,838 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

       

       

       

      13:42:32,842 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

       

       

       

       

      13:42:32,846 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

       

       

       

       

      13:42:32,852 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

       

       

       

       

      13:42:32,856 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

       

       

       

       

      13:42:32,859 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

       

       

       

       

      13:42:32,864 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

       

       

       

       

      13:42:32,868 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

       

       

       

       

      13:42:32,872 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:397)

       

       

       

       

      13:42:32,875 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

       

       

       

       

      13:42:32,879 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

       

       

       

       

      13:42:32,883 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

       

       

       

       

      13:42:32,887 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

       

       

       

       

      13:42:32,892 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

       

       

       

       

      13:42:32,896 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at java.lang.Thread.run(Thread.java:662)

       

       

       

       

      13:42:32,899 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions

      13:42:32,904 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) java.util.Map is an interface, and JAXB can't handle interfaces.

      13:42:32,907 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) this problem is related to the following location:

      13:42:32,909 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at java.util.Map

      13:42:32,910 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at private java.util.Map org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem.parameters

      13:42:32,913 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem

      13:42:32,915 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at private java.util.List org.kie.services.client.serialization.jaxb.impl.JaxbCommandsResponse.responses

      13:42:32,918 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.jaxb.impl.JaxbCommandsResponse

      13:42:32,920 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) java.util.Map does not have a no-arg default constructor.

      13:42:32,923 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) this problem is related to the following location:

      13:42:32,927 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at java.util.Map

      13:42:32,929 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at private java.util.Map org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem.parameters

      13:42:32,933 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem

      13:42:32,936 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at private java.util.List org.kie.services.client.serialization.jaxb.impl.JaxbCommandsResponse.responses

      13:42:32,940 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.jaxb.impl.JaxbCommandsResponse

      13:42:32,944 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)

       

       

       

       

      13:42:32,945 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)

       

       

       

       

      13:42:32,950 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)

       

       

       

       

      13:42:32,954 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)

       

       

       

       

      13:42:32,958 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)

       

       

       

       

      13:42:32,961 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)

       

       

       

       

      13:42:32,964 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)

       

       

       

       

      13:42:32,966 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       

       

       

       

      13:42:32,968 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       

       

       

       

      13:42:32,972 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       

       

       

       

      13:42:32,974 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at java.lang.reflect.Method.invoke(Method.java:597)

       

       

       

       

      13:42:32,976 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)

       

       

       

       

      13:42:32,978 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.xml.bind.ContextFinder.find(ContextFinder.java:392)

       

       

       

       

      13:42:32,980 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)

       

       

       

       

      13:42:32,983 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565)

       

       

       

       

      13:42:32,985 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.kie.services.client.serialization.JaxbSerializationProvider.initializeJaxbContext(JaxbSerializationProvider.java:76)

       

       

       

       

      13:42:32,989 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) ... 23 more

       

       

       

       

      When I searched up on this error I found this link on it https://bugzilla.redhat.com/show_bug.cgi?id=1033590. So I replaced the 6.0.0 jars with the 6.0.1 jars that are currently the latest available but the error is still coming. Is this an issue for which a fix is not done yet?

      Does this happen in JBPM 5 for instance as well?

        • 1. Re: JBPM 6 exception while trying to start a process using API
          Gabriel Vince Newbie

          Hi,

           

          Note: the exception you get on the client side is, that the server cannot serialize an exception. Therefore it would be good to have a look at the server side logs.

           

          I believe the problem will be with the deploymentId, it should have a maven format <groupId>:<artifactId>:<version>, e.g. org.jbm:HR:1.0 

          See the project details of your process deployment.

           

          Carpe diem

                       Gabriel

          • 2. Re: JBPM 6 exception while trying to start a process using API
            Prateek Mehra Newbie

            Hi Gabriel,

             

            I updated my code to start the Evaluation sample process instead of the one I had created. However the same issue is coming still. I used the following as the details I pass to the RemoteRestRuntimeFactory and KieSession to start the process:

             

            deploymentId = "org.jbpm:Evaluation:1.0"

            user = "krisv"

            password = "krisv"

            To the startProcess method of the KieSession I passed "evaluation" (the Definition Id).


            I am checking the server.log in Jboss for the debugging. Is there any other log I can refer to? 

            • 3. Re: JBPM 6 exception while trying to start a process using API
              Gabriel Vince Newbie

              Hello Prateek,

               

              that works for me.. code snippet:

                             String deploymentId = "org.jbpm:Evaluation:1.0";
                             URL baseUrl = new URL("http://localhost:8080/jbpm-console");
                             String username = "krisv";
                             String password = "krisv";
                             RemoteRestRuntimeFactory rFactory = new RemoteRestRuntimeFactory(
                                       deploymentId, baseUrl, username, password);
                             
                             RemoteRuntimeEngine engine = rFactory.newRuntimeEngine();
                             KieSession ksession = engine.getKieSession();
              
                             ProcessInstance pInstance = ksession.startProcess("evaluation");
                             long parentId = pInstance.getId();
              

               

              btw - don't forget to build and deploy the Evaluation project before calling it..

               

              Have fun.. Gabriel

              • 4. Re: JBPM 6 exception while trying to start a process using API
                Prateek Mehra Newbie

                Hi Gabriel,

                 

                I did deploy the Evaluation process, but strangely still not getting it. Anyways, I tried with the REST API instead and it worked So I shall use it and proceed for the moment.

                Thanks for the help!

                • 5. Re: JBPM 6 exception while trying to start a process using API
                  Jaykumar Pandya Novice

                  I am not able to find jar file for RemoteRestRuntimeFactory, can you please tell me how to resolve this issue?

                  • 6. Re: JBPM 6 exception while trying to start a process using API
                    Prateek Mehra Newbie

                    Include the kie-services-client jar for this. You can include the complete set of jars that are in the jbpm runtime folder of the installation when extracted

                    • 7. Re: JBPM 6 exception while trying to start a process using API
                      Jaykumar Pandya Novice

                      Prateek,

                       

                      when i used the same code, i am getting an exception java.lang.RuntimeException: Unable to post request: could not find writer for content-type application/xml type: org.kie.services.client.serialization.jaxb.impl.JaxbCommandsRequest when i am calling start process. can you please help me, i also tried to invoke my jBPM service using following method but there also i got the same error

                       

                      RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory(deploymentId, baseURL, userId, password);

                        RuntimeEngine engine = restSessionFactory.newRuntimeEngine();

                        KieSession ksession = engine.getKieSession();

                        Collection<ProcessInstance> col = ksession.getProcessInstances();

                                TaskService taskService = engine.getTaskService();        

                               List<TaskSummary> tasksAssignedAsPotentialOwner = taskService.getTasksAssignedAsPotentialOwner("bpmuser", "en-UK");

                      • 8. Re: JBPM 6 exception while trying to start a process using API
                        Mauricio Salatino Master

                        Hi Jaykumar,

                        Looking at the code that you are pasting here you are not calling the start process method ...

                        so What's the problem? can you please be more specific and share all the code that is needed to understand the problem?

                        Regards

                        • 9. Re: JBPM 6 exception while trying to start a process using API
                          Jaykumar Pandya Novice

                          Hi,

                           

                          We have jBPM service already running on server so i didnt get what you are asking about starting service.

                          I am creating one JAVA desktop application which l will migrate to maven, as of now i want to get tasks assigned to specific user and for the same i have written following code, can you please suggest what wrong i am doing? Also i will be very thankful to you if you can guide me on how to use REST API URL to invoke any jBPM service from our code.

                           

                          RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory(deploymentId, baseURL, userId, password);
                          RuntimeEngine engine = restSessionFactory.newRuntimeEngine();
                          KieSession ksession = engine.getKieSession();
                          TaskService taskService = engine.getTaskService();

                              List<TaskSummary> tasksAssignedAsPotentialOwner = taskService.getTasksAssignedAsPotentialOwner("bpmuser", "en-UK");

                          • 10. Re: JBPM 6 exception while trying to start a process using API
                            Prateek Mehra Newbie

                            Hi Jayakumar

                             

                            when you say your jbpm service is running, is your process started there? Actually once you get the ksession after that step you have to call startProcess method, which will begin the process. Then you should be able to get the process details and the tasks.

                            for me though, I moved ahead using the Rest API instead. I used the apache http client to make rest calls as mentioned in the user guide and am able to start processes and also get tasks for user, start and stop tasks etc. I can post the code later if you want

                            • 11. Re: JBPM 6 exception while trying to start a process using API
                              Jaykumar Pandya Novice

                              Prateek, i request you to kindly post the code.

                              also please review below code, as per your suggestion i put start process but still i am getting the same error

                                             KieSession ksession = engine.getKieSession();
                                             ProcessInstance processInstance = ksession.startProcess("Evaluation");
                                             TaskService taskService = engine.getTaskService();

                                             taskService.getTasksAssignedAsPotentialOwner(username1,"en-UK");

                               

                              Still Kiesession, everything is working fine and after that i am getting exception so request you to kindly share your code snippet.

                              • 12. Re: JBPM 6 exception while trying to start a process using API
                                Prateek Mehra Newbie

                                String deploymentId = "org.jbpm:Evaluation:1.0";

                                               URL baseUrl = new URL("http://localhost:8080/jbpm-console");

                                               String username = "krisv";

                                               String password = "krisv";

                                               RemoteRestRuntimeFactory rFactory = new RemoteRestRuntimeFactory(

                                                         deploymentId, baseUrl, username, password);

                                           

                                               RemoteRuntimeEngine engine = rFactory.newRuntimeEngine();

                                               KieSession ksession = engine.getKieSession();

                                 

                                               ProcessInstance pInstance = ksession.startProcess("evaluation");

                                               long parentId = pInstance.getId();

                                 

                                The process definition id is evaluation (with a small 'e'). You are passing the user as 'krisv' right? Try using the above. I will post the REST URL code later tonight.

                                • 13. Re: JBPM 6 exception while trying to start a process using API
                                  Mauricio Salatino Master

                                  Hi Jay,

                                  Can you please share what the error is? the code that you are pasting here look ok.. so unless you describe the error and the line that is causing it, it is complicated for us to help.

                                  Regards

                                  • 14. Re: JBPM 6 exception while trying to start a process using API
                                    Jaykumar Pandya Novice

                                    Hi,

                                    with the code above given by Prateek, i am getting following exception when i tried to start the processs

                                     

                                    Unable to post request: could not find writer for content-type application/xml type: org.kie.services.client.serialization.jaxb.impl.JaxbCommandsRequest

                                    1 2 Previous Next