Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-7856

java.lang.ClassCastException: java.lang.Class cannot be cast to org.kie.api.event.rule.RuleRuntimeEventListener

XMLWordPrintable

    • NEW
    • NEW
    • Hide
      • Unzip DebugRuleRuntimeEventListener_kjar.zip
      • mvn clean install
      • Upload target/debug-listener-kjar-1.0.0-SNAPSHOT.jar to business-central
      • Deploy the kjar for kie-server
      • Start the deployment
      Show
      Unzip DebugRuleRuntimeEventListener_kjar.zip mvn clean install Upload target/debug-listener-kjar-1.0.0-SNAPSHOT.jar to business-central Deploy the kjar for kie-server Start the deployment

      If you configure event listeners in kmodule.xml,

      <kmodule xmlns="http://www.drools.org/xsd/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <kbase name="defaultKieBase" default="true" eventProcessingMode="stream" equalsBehavior="identity">
          <ksession name="defaultKieSession" type="stateful" default="true" clockType="realtime">
            <fileLogger file="/tmp/AuditDebug.log" threaded="true" interval="1000" />
            <listeners>
              <ruleRuntimeEventListener type="org.drools.core.event.DebugRuleRuntimeEventListener"/>
              <agendaEventListener type="org.drools.core.event.DebugAgendaEventListener"/>
              <processEventListener type="org.drools.core.event.DebugProcessEventListener"/>
            </listeners>
          </ksession>
        </kbase>
      </kmodule>
      

      You get the following error on kjar deployment/start in kie-server. (Note: the kjar contains a rule flow bpmn2 file so JbpmKieServerExtension is triggered)

      14:37:36,218 ERROR [stderr] (default task-8) java.lang.ClassCastException: java.lang.Class cannot be cast to org.kie.api.event.rule.RuleRuntimeEventListener
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.drools.compiler.kie.util.InjectionHelper.wireListeners(InjectionHelper.java:111)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.drools.compiler.kie.util.InjectionHelper.wireSessionComponents(InjectionHelper.java:75)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.drools.compiler.kie.util.InjectionHelper.wireSessionComponents(InjectionHelper.java:65)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.runtime.manager.impl.KModuleRegisterableItemsFactory.getWorkItemHandlers(KModuleRegisterableItemsFactory.java:91)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.runtime.manager.impl.AbstractRuntimeManager.registerItems(AbstractRuntimeManager.java:146)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.runtime.manager.impl.SingletonRuntimeManager.init(SingletonRuntimeManager.java:116)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newSingletonRuntimeManager(RuntimeManagerFactoryImpl.java:64)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.kie.services.impl.AbstractDeploymentService.commonDeploy(AbstractDeploymentService.java:136)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:203)
      14:37:36,219 ERROR [stderr] (default task-8) 	at org.kie.server.services.jbpm.JbpmKieServerExtension.createContainer(JbpmKieServerExtension.java:416)
      14:37:36,220 ERROR [stderr] (default task-8) 	at org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:248)
      14:37:36,220 ERROR [stderr] (default task-8) 	at org.kie.server.remote.rest.common.resource.KieServerRestImpl.createContainer(KieServerRestImpl.java:138)
      ...
      

      It falls back to 2nd try and event listeners are eventually registered.

      https://github.com/kiegroup/jbpm/blob/7.11.x/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/KModuleRegisterableItemsFactory.java#L91-L95

      The error is ignorable so debug log level would be suitable for this error stack.

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: