1 Reply Latest reply on Apr 26, 2010 6:18 AM by jelies

    org.jbpm.bpmn.model.BpmnProcessDefinition cannot be cast to org.jbpm.api.ProcessDefinitionImpl

    michelemauro

      Hi all!

       

      I'm porting an application from jbpm3 to jbpm4, replacing the necessary parts. Our main goal is to be able to run BPMN2 diagrams. I have Spring 3 integration set up and all that, but I'm stumbling on an error I can't explain. I have searched google and the jira to no avail...

       

      The setup:

      I deploy the vacation process:

       

      String key = repo.createDeployment().addResourceFromClasspath(

                "processes/vacationrequest.bpmn.xml").deploy();

            System.out.println("Deployed: " + key);

            List<Deployment> deps = repo.createDeploymentQuery().list();

            for (Deployment d : deps)

              System.out.println(d.getId() + " " + d.getName() + " " + d.getState());

       

      And everything goes fine. When I go querying for that process definition, however, I get:

       

      Code:

       

          Deployment d=repo.createDeploymentQuery().list().get(0);

          String key= d.getId();   

          List<ProcessDefinition> list = repo.createProcessDefinitionQuery()

              .deploymentId(key).list();

       

      Exception:

       

      java.lang.ClassCastException: org.jbpm.bpmn.model.BpmnProcessDefinition cannot be cast to org.jbpm.api.ProcessDefinitionImpl

      at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:72)

      at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:87)

      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)

      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)

      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)

      at org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:68)

      at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.list(ProcessDefinitionQueryImpl.java:141)

      at my.company.app.service.ContextRefreshListener.onApplicationEvent(ContextRefreshListener.java:46)

      ....

       

      I can't understand why: the types are compatible. A classloader issue? but how?

       

      The setup is quite trivial:

      Hypersonic db - Spring 3 - Jetty webserver launched with mvn jetty:run

       

      Anyone has a clue?

       

      Thank you in advance,

       

      Michele Mauro

        • 1. Re: org.jbpm.bpmn.model.BpmnProcessDefinition cannot be cast to org.jbpm.api.ProcessDefinitionImpl
          jelies

          Hi Michele,

           

          do you have solved the problem? If not, maybe this will help you, else maybe you could help me (you could see my post here)...

           

          I'm getting a similar error, in the same line, calling the same method... but in my case I'm loading a jpdl.xml and the class cast it's different, throwing a similar error:

           

          {code:java} java.lang.ClassCastException: org.jbpm.jpdl.internal.model.JpdlProcessDefinition cannot be cast to org.jbpm.pvm.internal.model.ProcessDefinitionImpl {code}
          

           

          To be more exact, in my code the cast is from JpdlProcessDefinition to org.jbpm.pvm.internal.model.ProcessDefinitionImpl, ubicated in a different package from yours. Your package doesn't exist in the jbpm.jar distributable of version 4.3 (I supose this package existed in the version you used).

           

          Any help would be appreciated.