4 Replies Latest reply on Feb 21, 2013 3:22 PM by sc_boss


    sc_boss Newbie

      I've a simple java that uses HornetQ workitem handler for human tasks. I keep getting this error when I guess human task server responds back. What is the issue here and how to fix it?  


      SEVERE: Client Exception with class class org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1 using port 5153

      java.lang.ClassCastException: org.jbpm.task.service.responsehandlers.BlockingGetContentResponseHandler cannot be cast to org.jbpm.task.service.TaskClientHandler$GetTaskResponseHandler

          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:75)

          at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56)

          at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:122)

          at java.lang.Thread.run(Thread.java:662)

        • 1. Re: ClassCastException
          Maciej Swiderski Master

          could you provide more information when it happen? What operation do you invoke when this error occurs?

          • 2. Re: ClassCastException
            sc_boss Newbie

            It is a simple program with very little modification to the evaluation process that comes with installation. I've configured my DB as Oracle.


            Attached is the log generated. My apologies for any stupid mistake in the program. I'm still trying to get comfortable with JBPM.


            My Process basically takes a name and the user tries to modify it trough UI.


            Please note that the process is generating tasks properly as I can see it in inbox of krisv.


            public class ProcessTest


                public static final void main(String[] args) throws Exception


                   StatefulKnowledgeSession ksession = null;

                    KnowledgeRuntimeLogger logger = null;

                    HornetQHTWorkItemHandler humanTaskHandler = null;

                    try {

                        // load up the knowledge base

                        KnowledgeBase kbase = readKnowledgeBase();


                        ksession = createKnowledgeSession(kbase);


                        humanTaskHandler = new HornetQHTWorkItemHandler(ksession);



                        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);


                        logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);


                        final StatefulKnowledgeSession k = ksession;

                        final KnowledgeRuntimeLogger l = logger;


                        // start a new process instance

                        Map<String, Object> params = new HashMap<String, Object>();

                        //params.put("employee", "krisv");

                        //params.put("reason", "Yearly performance evaluation");

                        params.put("name", "some name".toLowerCase());


                        //ProcessInstance pi = ksession.startProcess("com.sample.evaluation", params);

                        ProcessInstance pi =

                            ksession.startProcess("mypackage.test1", params);


                        System.out.println("Process started ... "+pi.getId());

                        System.out.println("Process state ... "+pi.getState());

                    } catch (Throwable t) {



                    finally {

                        if(ksession != null) ksession.dispose();

                        if(humanTaskHandler != null) humanTaskHandler.dispose();

                        if(logger != null) logger.close();




                private static KnowledgeBase readKnowledgeBase() throws Exception {

                    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();


                    String URL = "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/mypackage/LATEST";

                    UrlResource resource = (UrlResource) ResourceFactory.newUrlResource(URL);




                    kbuilder.add(resource, ResourceType.PKG);




                    System.setProperty("java.naming.factory.initial", "bitronix.tm.jndi.BitronixInitialContextFactory");


                    //kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);

                    return kbuilder.newKnowledgeBase();



                private static void setupDb() {


                    PoolingDataSource ds = new PoolingDataSource();





                    ds.getDriverProperties().put("user", "jbpmprocess");

                    ds.getDriverProperties().put("password", "secret");

                    ds.getDriverProperties().put("URL", "jdbc:oracle:thin:@");




                private static StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase) {


                    Environment env = KnowledgeBaseFactory.newEnvironment();

                    env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" ) );


                    Properties properties = new Properties();

                    KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);


                    StatefulKnowledgeSession ksession =

                        JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );


                    return ksession;



            • 3. Re: ClassCastException
              Maciej Swiderski Master

              ok if it's an evaluation process then it could be that you suplly not valid employee that is process variable used to assign first task to. Antoher thing is that since you modified the evaluation process it could be that

              params.put("name", "some name".toLowerCase());

              "some name" must be know to task service unless you use DefaultUserGroupCallback that accepts all users.


              Since you provided logs from client execution it would be good to check server log where task service is running, there are most likely some errors that causing to return incorrect response.



              • 4. Re: ClassCastException
                sc_boss Newbie

                "name" is just a variable in my process. I checked the server logs and i did not see any error.


                Just FYI (if this helps) : Switching to AsyncHornetQHTWorkItemHandler fixed my issue. I dontt see any issue or errors.