[jboss-user] [jBPM] - WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime

Marcelo Zabalet do-not-reply at jboss.com
Wed Jan 9 12:45:44 EST 2013


Marcelo Zabalet [https://community.jboss.org/people/zabalet] created the discussion

"WorkflowProcessInstanceUpgrader throwing ClassCastException: ...CommandBasedStatefulKnowledgeSession cannot be cast to ...InternalKnowledgeRuntime"

To view the discussion, visit: https://community.jboss.org/message/789794#789794

--------------------------------------------------------------
Hi people!

I'm having this issue trying to upgrade process intances using WorkflowProcessInstanceUpgrader as described at  http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e2318 http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e2318

This is the line creating the knowledgeSession:

ksession = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, env);


and this is the line trying to upgrade:

WorkflowProcessInstanceUpgrader.upgradeProcessInstance(knowledgeSession, processInstance.getId(), newProcessDefinitionId, mapping);


Inside  https://github.com/droolsjbpm/jbpm/blob/5.4.0.Final/jbpm-flow/src/main/java/org/jbpm/workflow/instance/WorkflowProcessInstanceUpgrader.java WorkflowProcessInstanceUpgrader there is the casting causing the problem

processInstance.setKnowledgeRuntime((InternalKnowledgeRuntime) kruntime);


The point is that CommandBasedStatefulKnowledgeSession does not implements InternalKnowledgeRuntime like his counterparts implementing StatefulKnowledgeSession.

   _StatefulKnowledgeSession
    |__CommandBasedStatefulKnowledgeSession (NOT implements InternalKnowledgeRuntime)
    |__StatefulKnowledgeSessionImpl (implements InternalKnowledgeRuntime)
    |__StatefulProcessSession (implements InternalKnowledgeRuntime)


Then:

- Should CommandBasedStatefulKnowledgeSession implement InternalKnowledgeRuntime like his counterparts?

- Should I use a different implementation of StatefulKnowledgeSession?

- There is a bigger issue around this inherent to the command based nature?

(This same issue was somehow asked  https://community.jboss.org/message/634907#634907 here (https://community.jboss.org/message/634907#634907) but there was no feedback)

TIA.

Marcelo.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/789794#789794]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130109/0f3e20e1/attachment.html 


More information about the jboss-user mailing list