JBoss Community

ClassCastException in DynamicUtils when using JPAKnowledgeService.loadStatefulKnowledgeSession()

created by Wooi Joe Chuah in jBPM - View the full discussion

Hi,

 

I've encountered the problem as stated above when using DynamicUtils to addDynamicSubProcess at the following line

 

ProcessEventSupport eventSupport = ((InternalProcessRuntime)((InternalKnowledgeRuntime)ksession).getProcessRuntime()).getProcessEventSupport();

 

The reason as far as I know is because the ksession returned from JPAKnowledgeService.loadStatefulKnowledgeSession() or newStatefulKnowledgeSession()

which is implemented using org.drools.persistence.jpa.KnowledgeStoreServiceImpl

returns the ksession as a CommandBasedStatefulKnowledgeSession object instance.

 

The CommandBasedStatefulKnowledgeSession does not implement InternalKnowledgeRuntime and hence we hit a class cast exception.

 

The same problem does not occur when using a ksession from the KnowledgeBuilder>KnowledgeBase>ksession.

 

Any idea if CommandBasedStatefulKnowledgeSession is going to implement InternalKnowledgeRuntime in the future or

there's gonna be a fix for using sessions which are loaded from DB? or is it a limitation

 

Thanks.

Reply to this message by going to Community

Start a new discussion in jBPM at Community