Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 761427

Summary: ClassCastException when retrieving AgendaEventListener collection
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Radovan Synek <rsynek>
Component: BRE (Expert, Fusion), jBPM 5Assignee: Mario Fusco <mfusco>
Status: CLOSED UPSTREAM QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: mproctor
Target Milestone: ---Keywords: TestBlocker
Target Release: future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When attempting to retrieve the AgendaEventerLister count registered in a stateful knowledge sessions a 'Requesting Process failed' exception is thrown.
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:14:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Radovan Synek 2011-12-08 10:19:32 UTC
Following part of Spring configuration:

<bean id="debug-agenda-listener" class="org.drools.event.DebugAgendaEventListener" />
<drools:ksession id="statefulSession" type="stateful" kbase="kbase1">
           <drools:agendaEventListener ref="debug-agenda-listener"/>
</drools:ksession>

when trying to find out AgendaEventListener count registered in knowledge stateful session, got this exception:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: org.jbpm.process.instance.ProcessRuntimeImpl$3 cannot be cast to org.drools.event.rule.AgendaEventListener
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

root cause

java.lang.ClassCastException: org.jbpm.process.instance.ProcessRuntimeImpl$3 cannot be cast to org.drools.event.rule.AgendaEventListener
	org.drools.impl.StatefulKnowledgeSessionImpl.getAgendaEventListeners(StatefulKnowledgeSessionImpl.java:182)
	com.redhat.droolsspring.controllers.DroolsIntegrationStatefulTest.testAgendaListener(DroolsIntegrationStatefulTest.java:28)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:616)
	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:174)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

See attachment 542456 [details]:
build as maven project, then deploy to tomcat, open webapp in browser and click
on the first link.

Comment 1 Tomas Schlosser 2012-01-13 07:59:16 UTC
*** Bug 781288 has been marked as a duplicate of this bug. ***

Comment 3 Lukáš Petrovický 2012-01-13 08:05:52 UTC
As mentioned in bug 781288, this bug clearly doesn't affect just Spring. It is a deeper issue.

Comment 5 Mark Proctor 2012-01-19 00:59:22 UTC
I've assigned this to mario. While the issue is in jBPM code, it's related to rules, and will be good for him to see how the projects interact with each other.

Comment 7 Mark Proctor 2012-02-07 18:08:11 UTC
I cherry-picked https://issues.jboss.org/browse/JBRULES-3380 to 5.3.x which should make this bug easier to fix.

Comment 8 Radovan Synek 2012-02-28 15:19:25 UTC
reproducer added to pull request:
https://github.com/droolsjbpm/droolsjbpm-integration/pull/12

Comment 9 JBoss JIRA Server 2012-03-01 15:35:13 UTC
Mario Fusco <mario.fusco> updated the status of jira JBRULES-3378 to Resolved

Comment 10 Ryan Zhang 2012-03-21 09:55:22 UTC
Please verify this issue on ER5.

Comment 11 JBoss JIRA Server 2012-04-02 03:57:12 UTC
Mark Proctor <mark.proctor> updated the status of jira JBRULES-3380 to Resolved

Comment 12 JBoss JIRA Server 2012-04-02 03:57:21 UTC
Mark Proctor <mark.proctor> updated the status of jira JBRULES-3380 to Closed

Comment 13 Radovan Synek 2012-04-24 12:51:24 UTC
This issue still persists on ER6.

Actually I have found a reproducer in the project code:

https://github.com/droolsjbpm/droolsjbpm-integration/blob/5.3.x/drools-container/drools-spring/src/test/java/org/drools/container/spring/SpringDroolsListenersTest.java

Please uncomment the @Test annotation over testStatefulAgendaEventListener() method and run the test case, it gives me the same CCE.

Comment 15 Mario Fusco 2012-04-25 06:43:59 UTC
This issue has been fixed in jBPM 5.3 with the following commit:

https://github.com/droolsjbpm/jbpm/commit/e1117535baa03f2a0645b87dd55030bb0

Comment 16 lcarlon 2012-06-08 03:08:46 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When attempting to retrieve the AgendaEventerLister count registered in a stateful knowledge sessions a 'Requesting Process failed' exception is thrown.

Comment 23 Red Hat Bugzilla 2025-02-10 03:14:30 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.